]> granicus.if.org Git - clang/commitdiff
Make sure we initialize the "extra" data within the libclang code
authorDouglas Gregor <dgregor@apple.com>
Mon, 10 Oct 2011 23:37:54 +0000 (23:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 10 Oct 2011 23:37:54 +0000 (23:37 +0000)
completion context, in case we end up having no code-completion
callback. Individual instances of this problem are always bugs that
need to be fixed, but it's better to make sure we have initialized
data here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141598 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndexCodeCompletion.cpp

index b419fd6850eb413ff547f1204d28330ea147766c..3ce0d245cf3f61b1f4ebd6a1f0b7fce4a56c21b8 100644 (file)
@@ -274,7 +274,12 @@ AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
                    llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
     FileSystemOpts(FileSystemOpts),
     FileMgr(new FileManager(FileSystemOpts)),
-    SourceMgr(new SourceManager(*Diag, *FileMgr)) { 
+    SourceMgr(new SourceManager(*Diag, *FileMgr)),
+    Contexts(CXCompletionContext_Unknown),
+    ContainerKind(CXCursor_InvalidCode),
+    ContainerUSR(createCXString("")),
+    ContainerIsIncomplete(1)
+{ 
   if (getenv("LIBCLANG_OBJTRACKING")) {
     llvm::sys::AtomicIncrement(&CodeCompletionResultObjects);
     fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects);