Home | History | Annotate | Download | only in libclang
      1 //===- CXTranslationUnit.h - Routines for manipulating CXTranslationUnits -===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines routines for manipulating CXTranslationUnits.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_CLANG_CXTRANSLATIONUNIT_H
     15 #define LLVM_CLANG_CXTRANSLATIONUNIT_H
     16 
     17 extern "C" {
     18 struct CXTranslationUnitImpl {
     19   void *CIdx;
     20   void *TUData;
     21   void *StringPool;
     22   void *Diagnostics;
     23 };
     24 }
     25 
     26 namespace clang {
     27   class ASTUnit;
     28   class CIndexer;
     29 
     30 namespace cxtu {
     31 
     32 CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU);
     33 
     34 class CXTUOwner {
     35   CXTranslationUnitImpl *TU;
     36 
     37 public:
     38   CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
     39   ~CXTUOwner();
     40 
     41   CXTranslationUnitImpl *getTU() const { return TU; }
     42 
     43   CXTranslationUnitImpl *takeTU() {
     44     CXTranslationUnitImpl *retTU = TU;
     45     TU = 0;
     46     return retTU;
     47   }
     48 };
     49 
     50 
     51 }} // end namespace clang::cxtu
     52 
     53 #endif
     54