blob: b2b1b8403779941fa58a2017fe321bebd713a02e [file] [log] [blame]
Ted Kremenek0a90d322010-11-17 23:24:11 +00001//===- 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 *TUData;
20 void *StringPool;
Ted Kremenek15322172011-11-10 08:43:12 +000021 void *Diagnostics;
Ted Kremenek0a90d322010-11-17 23:24:11 +000022};
23}
24
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000025namespace clang {
26 class ASTUnit;
27
28namespace cxtu {
29
30CXTranslationUnitImpl *MakeCXTranslationUnit(ASTUnit *TU);
Ted Kremenek15322172011-11-10 08:43:12 +000031
Argyrios Kyrtzidis4e7064f2011-10-17 19:48:19 +000032class CXTUOwner {
33 CXTranslationUnitImpl *TU;
34
35public:
36 CXTUOwner(CXTranslationUnitImpl *tu) : TU(tu) { }
37 ~CXTUOwner();
38
39 CXTranslationUnitImpl *getTU() const { return TU; }
40
41 CXTranslationUnitImpl *takeTU() {
42 CXTranslationUnitImpl *retTU = TU;
43 TU = 0;
44 return retTU;
45 }
46};
47
48
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000049}} // end namespace clang::cxtu
50
Ted Kremenek0a90d322010-11-17 23:24:11 +000051#endif