From: Douglas Gregor Date: Wed, 24 Mar 2010 21:04:06 +0000 (+0000) Subject: Make sure that we have File IDs for all of the unsaved files before we X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7353c08d440aa3c1db46b181aff6c4eb41bbcab;p=clang Make sure that we have File IDs for all of the unsaved files before we deserialize diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99426 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Index/Inputs/remap-complete-to.c b/test/Index/Inputs/remap-complete-to.c index 9f8be2cbec..30199db51a 100644 --- a/test/Index/Inputs/remap-complete-to.c +++ b/test/Index/Inputs/remap-complete-to.c @@ -1 +1,6 @@ -void f0() { } +int f0(int *pointer1, float *pointer2) { + return pointer2 - pointer1; +} + +void g() { + diff --git a/test/Index/remap-complete.c b/test/Index/remap-complete.c index 9b7de0699d..813d1dfcf4 100644 --- a/test/Index/remap-complete.c +++ b/test/Index/remap-complete.c @@ -1,5 +1,8 @@ -// RUN: c-index-test -code-completion-at=%s:1:12 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:6:2 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s 2> %t.err | FileCheck %s +// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t.err // XFAIL: win32 -// CHECK: FunctionDecl:{ResultType void}{TypedText f0}{LeftParen (}{RightParen )} +// CHECK: FunctionDecl:{ResultType int}{TypedText f0}{LeftParen (} void f() { } + +// CHECK-DIAGS: remap-complete.c:2:19 diff --git a/tools/CIndex/CIndexDiagnostic.cpp b/tools/CIndex/CIndexDiagnostic.cpp index 6aed49eaae..f4454d46f6 100644 --- a/tools/CIndex/CIndexDiagnostic.cpp +++ b/tools/CIndex/CIndexDiagnostic.cpp @@ -265,6 +265,7 @@ void clang::LoadSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath, } SourceMgr.overrideFileContents(File, Buffer); + SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User); } // Parse the diagnostics, emitting them one by one until we've