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   void *OverridenCursorsPool;
     24 };
     25 }
     26 
     27 namespace clang {
     28   class ASTUnit;
     29   class CIndexer;
     30 
     31 namespace cxtu {
     32 
     33 CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU);
     34 
     35 class CXTUOwner {
     36   CXTranslationUnitImpl *TU;
     37 
     38 public:
     39   CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
     40   ~CXTUOwner();
     41 
     42   CXTranslationUnitImpl *getTU() const { return TU; }
     43 
     44   CXTranslationUnitImpl *takeTU() {
     45     CXTranslationUnitImpl *retTU = TU;
     46     TU = 0;
     47     return retTU;
     48   }
     49 };
     50 
     51 
     52 }} // end namespace clang::cxtu
     53 
     54 #endif
     55