From e3c60a7ce9e0f42c7ca2344b33203266aceca1db Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 17 Nov 2010 00:13:31 +0000 Subject: Fix source-range information for Objective-C properties. Previously, we were just getting a range covering only the property name, which is certainly not correct (and broke token annotation, among other things). Also, teach libclang about the relationship between @synthesize/@dynamic and @property, so we get property name and cursor-reference information for @synthesize and @dynamic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119409 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/ASTUnit.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Frontend/ASTUnit.cpp') diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 80ce5220b6..fb93fca84a 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -81,6 +81,11 @@ namespace { /// preamble. const unsigned DefaultPreambleRebuildInterval = 5; +/// \brief Tracks the number of ASTUnit objects that are currently active. +/// +/// Used for debugging purposes only. +static unsigned ActiveASTUnitObjects; + ASTUnit::ASTUnit(bool _MainFileIsAST) : CaptureDiagnostics(false), MainFileIsAST(_MainFileIsAST), CompleteTranslationUnit(true), WantTiming(getenv("LIBCLANG_TIMING")), @@ -91,6 +96,10 @@ ASTUnit::ASTUnit(bool _MainFileIsAST) NumTopLevelDeclsAtLastCompletionCache(0), CacheCodeCompletionCoolDown(0), UnsafeToFree(false) { + if (getenv("LIBCLANG_OBJTRACKING")) { + ++ActiveASTUnitObjects; + fprintf(stderr, "+++ %d translation units\n", ActiveASTUnitObjects); + } } ASTUnit::~ASTUnit() { @@ -117,6 +126,11 @@ ASTUnit::~ASTUnit() { delete PreambleBuffer; ClearCachedCompletionResults(); + + if (getenv("LIBCLANG_OBJTRACKING")) { + --ActiveASTUnitObjects; + fprintf(stderr, "--- %d translation units\n", ActiveASTUnitObjects); + } } void ASTUnit::CleanTemporaryFiles() { -- cgit v1.2.3-70-g09d2