blob: 37789aafb9dbc84f3e19728834fcc153feed9984 [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 Kremenekbbf66ca2012-04-30 19:06:49 +000023 void *OverridenCursorsPool;
Ted Kremenek0a90d322010-11-17 23:24:11 +000024};
25}
26
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000027namespace clang {
28 class ASTUnit;
Argyrios Kyrtzidisfdc17952012-03-28 02:18:05 +000029 class CIndexer;
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000030
31namespace cxtu {
32
Argyrios Kyrtzidisfdc17952012-03-28 02:18:05 +000033CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *TU);
Ted Kremenek15322172011-11-10 08:43:12 +000034
Argyrios Kyrtzidis4e7064f2011-10-17 19:48:19 +000035class 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
Argyrios Kyrtzidis9049cf62011-10-12 07:07:33 +000052}} // end namespace clang::cxtu
53
Ted Kremenek0a90d322010-11-17 23:24:11 +000054#endif