1 //===- CXTranslationUnit.h - Routines for manipulating CXTranslationUnits -===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines routines for manipulating CXTranslationUnits.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXTRANSLATIONUNIT_H
15 #define LLVM_CLANG_TOOLS_LIBCLANG_CXTRANSLATIONUNIT_H
19 #include "clang-c/Index.h"
25 class CommentToXMLConverter;
29 struct CXTranslationUnitImpl {
30 clang::CIndexer *CIdx;
31 clang::ASTUnit *TheASTUnit;
32 clang::cxstring::CXStringPool *StringPool;
34 void *OverridenCursorsPool;
35 clang::index::CommentToXMLConverter *CommentToXML;
41 CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *AU);
43 static inline ASTUnit *getASTUnit(CXTranslationUnit TU) {
46 return TU->TheASTUnit;
49 /// \returns true if the ASTUnit has a diagnostic about the AST file being
51 bool isASTReadError(ASTUnit *AU);
53 static inline bool isNotUsableTU(CXTranslationUnit TU) {
57 #define LOG_BAD_TU(TU) \
60 *Log << "called with a bad TU: " << TU; \
65 CXTranslationUnitImpl *TU;
68 CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
71 CXTranslationUnitImpl *getTU() const { return TU; }
73 CXTranslationUnitImpl *takeTU() {
74 CXTranslationUnitImpl *retTU = TU;
81 }} // end namespace clang::cxtu