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