浏览代码

Make sure we initialize the "extra" data within the libclang code
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

Douglas Gregor 14 年之前
父节点
当前提交
b77d197a78
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      tools/libclang/CIndexCodeCompletion.cpp

+ 6 - 1
tools/libclang/CIndexCodeCompletion.cpp

@@ -274,7 +274,12 @@ AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
                    llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
                    llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
     FileSystemOpts(FileSystemOpts),
     FileSystemOpts(FileSystemOpts),
     FileMgr(new FileManager(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")) {
   if (getenv("LIBCLANG_OBJTRACKING")) {
     llvm::sys::AtomicIncrement(&CodeCompletionResultObjects);
     llvm::sys::AtomicIncrement(&CodeCompletionResultObjects);
     fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects);
     fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects);