2010-11-18 07:24:11 +08:00
|
|
|
//===- CXTranslationUnit.h - Routines for manipulating CXTranslationUnits -===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines routines for manipulating CXTranslationUnits.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_CXTRANSLATIONUNIT_H
|
|
|
|
#define LLVM_CLANG_CXTRANSLATIONUNIT_H
|
|
|
|
|
2013-01-27 02:53:38 +08:00
|
|
|
#include "clang-c/Index.h"
|
|
|
|
|
2013-01-27 05:32:42 +08:00
|
|
|
namespace clang {
|
|
|
|
class ASTUnit;
|
|
|
|
class CIndexer;
|
2013-01-27 05:39:50 +08:00
|
|
|
class SimpleFormatContext;
|
2013-01-27 05:32:42 +08:00
|
|
|
} // namespace clang
|
|
|
|
|
2010-11-18 07:24:11 +08:00
|
|
|
struct CXTranslationUnitImpl {
|
2012-03-28 10:18:05 +08:00
|
|
|
void *CIdx;
|
2013-01-27 05:32:42 +08:00
|
|
|
clang::ASTUnit *TheASTUnit;
|
2010-11-18 07:24:11 +08:00
|
|
|
void *StringPool;
|
2011-11-10 16:43:12 +08:00
|
|
|
void *Diagnostics;
|
2012-05-01 03:06:49 +08:00
|
|
|
void *OverridenCursorsPool;
|
2013-01-27 05:39:50 +08:00
|
|
|
clang::SimpleFormatContext *FormatContext;
|
2012-12-19 07:02:59 +08:00
|
|
|
unsigned FormatInMemoryUniqueId;
|
2010-11-18 07:24:11 +08:00
|
|
|
};
|
|
|
|
|
2011-10-12 15:07:33 +08:00
|
|
|
namespace clang {
|
|
|
|
namespace cxtu {
|
|
|
|
|
2013-01-27 05:32:42 +08:00
|
|
|
CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *AU);
|
2013-01-27 02:53:38 +08:00
|
|
|
|
|
|
|
static inline ASTUnit *getASTUnit(CXTranslationUnit TU) {
|
2013-01-27 05:32:42 +08:00
|
|
|
return TU->TheASTUnit;
|
2013-01-27 02:53:38 +08:00
|
|
|
}
|
|
|
|
|
2011-10-18 03:48:19 +08:00
|
|
|
class CXTUOwner {
|
|
|
|
CXTranslationUnitImpl *TU;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
|
|
|
|
~CXTUOwner();
|
|
|
|
|
|
|
|
CXTranslationUnitImpl *getTU() const { return TU; }
|
|
|
|
|
|
|
|
CXTranslationUnitImpl *takeTU() {
|
|
|
|
CXTranslationUnitImpl *retTU = TU;
|
|
|
|
TU = 0;
|
|
|
|
return retTU;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-12 15:07:33 +08:00
|
|
|
}} // end namespace clang::cxtu
|
|
|
|
|
2010-11-18 07:24:11 +08:00
|
|
|
#endif
|