CXTranslationUnit.h revision bbf66ca1dad17773cc682d69b8482c4e179aeaeb
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};
25}
26
27namespace clang {
28  class ASTUnit;
29  class CIndexer;
30
31namespace cxtu {
32
33CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU);
34
35class CXTUOwner {
36  CXTranslationUnitImpl *TU;
37
38public:
39  CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
40  ~CXTUOwner();
41
42  CXTranslationUnitImpl *getTU() const { return TU; }
43
44  CXTranslationUnitImpl *takeTU() {
45    CXTranslationUnitImpl *retTU = TU;
46    TU = 0;
47    return retTU;
48  }
49};
50
51
52}} // end namespace clang::cxtu
53
54#endif
55