CXTranslationUnit.h revision fdc1795acc9d5d73a767cc7d43ad1546e93adbba
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}; 24} 25 26namespace clang { 27 class ASTUnit; 28 class CIndexer; 29 30namespace cxtu { 31 32CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU); 33 34class CXTUOwner { 35 CXTranslationUnitImpl *TU; 36 37public: 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