blob: 3ad867ca8bf11f3e4315907f940bc4295d5f7dc7 [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 {
Argyrios Kyrtzidisfdc17952012-03-28 02:18:05 +000019 void *CIdx;
Ted Kremenek0a90d322010-11-17 23:24:11 +000020 void *TUData;
21 void *StringPool;
Ted Kremenek15322172011-11-10 08:43:12 +000022 void *Diagnostics;
Ted Kremenek0a90d322010-11-17 23:24:11 +000023};
24}
25
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000026namespace clang {
27 class ASTUnit;
Argyrios Kyrtzidisfdc17952012-03-28 02:18:05 +000028 class CIndexer;
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000029
30namespace cxtu {
31
Argyrios Kyrtzidisfdc17952012-03-28 02:18:05 +000032CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU);
Ted Kremenek15322172011-11-10 08:43:12 +000033
Argyrios Kyrtzidis4e7064f2011-10-17 19:48:19 +000034class 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
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000051}} // end namespace clang::cxtu
52
Ted Kremenek0a90d322010-11-17 23:24:11 +000053#endif