From 915542850b7bd6d8b9e3ff6535f38ce8f73bb8dd Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 16 Nov 2010 08:15:36 +0000 Subject: Change CXTranslationUnit to not directly cast to an ASTUnit*, but to wrap both an ASTUnit and a "string pool" that will be used for fast USR generation. This requires a bunch of mechanical changes, as there was a ton of code that assumed that CXTranslationUnit and ASTUnit* were the same. Along with this change, introduce CXStringBuf, which provides an llvm::SmallVector backing for repeatedly generating CXStrings without a huge amount of malloc() traffic. This requires making some changes to the representation of CXString by renaming a few fields (but keeping the size of the object the same). llvm-svn: 119337 --- clang/tools/libclang/CIndexDiagnostic.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/tools/libclang/CIndexDiagnostic.cpp') diff --git a/clang/tools/libclang/CIndexDiagnostic.cpp b/clang/tools/libclang/CIndexDiagnostic.cpp index 84f39e3ea00..31ca6791a6e 100644 --- a/clang/tools/libclang/CIndexDiagnostic.cpp +++ b/clang/tools/libclang/CIndexDiagnostic.cpp @@ -33,12 +33,12 @@ using namespace llvm; extern "C" { unsigned clang_getNumDiagnostics(CXTranslationUnit Unit) { - ASTUnit *CXXUnit = static_cast(Unit); + ASTUnit *CXXUnit = static_cast(Unit->TUData); return CXXUnit? CXXUnit->stored_diag_size() : 0; } CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, unsigned Index) { - ASTUnit *CXXUnit = static_cast(Unit); + ASTUnit *CXXUnit = static_cast(Unit->TUData); if (!CXXUnit || Index >= CXXUnit->stored_diag_size()) return 0; -- cgit v1.2.3