CXTranslationUnit.h revision 88b9521364735a6c9a7ccd23c5bd19d81a80cdd3
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 17extern "C" { 18struct CXTranslationUnitImpl { 19 void *CIdx; 20 void *TUData; 21 void *StringPool; 22 void *Diagnostics; 23 void *OverridenCursorsPool; 24 void *FormatContext; 25 unsigned FormatInMemoryUniqueId; 26}; 27} 28 29namespace clang { 30 class ASTUnit; 31 class CIndexer; 32 33namespace cxtu { 34 35CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU); 36 37class CXTUOwner { 38 CXTranslationUnitImpl *TU; 39 40public: 41 CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { } 42 ~CXTUOwner(); 43 44 CXTranslationUnitImpl *getTU() const { return TU; } 45 46 CXTranslationUnitImpl *takeTU() { 47 CXTranslationUnitImpl *retTU = TU; 48 TU = 0; 49 return retTU; 50 } 51}; 52 53 54}} // end namespace clang::cxtu 55 56#endif 57