Ted Kremenek | 0a90d32 | 2010-11-17 23:24:11 +0000 | [diff] [blame] | 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 | |
| 17 | extern "C" { |
| 18 | struct CXTranslationUnitImpl { |
| 19 | void *TUData; |
| 20 | void *StringPool; |
Ted Kremenek | 1532217 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 21 | void *Diagnostics; |
Ted Kremenek | 0a90d32 | 2010-11-17 23:24:11 +0000 | [diff] [blame] | 22 | }; |
| 23 | } |
| 24 | |
Argyrios Kyrtzidis | 9049cf6 | 2011-10-12 07:07:33 +0000 | [diff] [blame] | 25 | namespace clang { |
| 26 | class ASTUnit; |
| 27 | |
| 28 | namespace cxtu { |
| 29 | |
| 30 | CXTranslationUnitImpl *MakeCXTranslationUnit(ASTUnit *TU); |
Ted Kremenek | 1532217 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 31 | |
Argyrios Kyrtzidis | 4e7064f | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 32 | class CXTUOwner { |
| 33 | CXTranslationUnitImpl *TU; |
| 34 | |
| 35 | public: |
| 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 Kyrtzidis | 9049cf6 | 2011-10-12 07:07:33 +0000 | [diff] [blame] | 49 | }} // end namespace clang::cxtu |
| 50 | |
Ted Kremenek | 0a90d32 | 2010-11-17 23:24:11 +0000 | [diff] [blame] | 51 | #endif |