aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndexCodeCompletion.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-17 00:13:31 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-17 00:13:31 +0000
commite3c60a7ce9e0f42c7ca2344b33203266aceca1db (patch)
treee343de8a6513e0319f84b008942f1b2a0eeba8e5 /tools/libclang/CIndexCodeCompletion.cpp
parent74fb0edb44b7ed52af9b8053032ccaab29b5c0cc (diff)
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
Diffstat (limited to 'tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r--tools/libclang/CIndexCodeCompletion.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp
index d0eb5cc7e3..74c3274ad6 100644
--- a/tools/libclang/CIndexCodeCompletion.cpp
+++ b/tools/libclang/CIndexCodeCompletion.cpp
@@ -250,9 +250,20 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
llvm::SmallVector<const llvm::MemoryBuffer *, 1> TemporaryBuffers;
};
+/// \brief Tracks the number of code-completion result objects that are
+/// currently active.
+///
+/// Used for debugging purposes only.
+static unsigned CodeCompletionResultObjects;
+
AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults()
: CXCodeCompleteResults(), Diag(new Diagnostic),
- SourceMgr(*Diag, FileMgr, FileSystemOpts) { }
+ SourceMgr(*Diag, FileMgr, FileSystemOpts) {
+ if (getenv("LIBCLANG_OBJTRACKING")) {
+ ++CodeCompletionResultObjects;
+ fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects);
+ }
+}
AllocatedCXCodeCompleteResults::~AllocatedCXCodeCompleteResults() {
for (unsigned I = 0, N = NumResults; I != N; ++I)
@@ -263,6 +274,11 @@ AllocatedCXCodeCompleteResults::~AllocatedCXCodeCompleteResults() {
TemporaryFiles[I].eraseFromDisk();
for (unsigned I = 0, N = TemporaryBuffers.size(); I != N; ++I)
delete TemporaryBuffers[I];
+
+ if (getenv("LIBCLANG_OBJTRACKING")) {
+ --CodeCompletionResultObjects;
+ fprintf(stderr, "--- %d completion results\n", CodeCompletionResultObjects);
+ }
}
} // end extern "C"