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 9f8be2c..30199db 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 9b7de06..813d1df 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 6aed49e..f4454d4 100644
--- a/tools/CIndex/CIndexDiagnostic.cpp
+++ b/tools/CIndex/CIndexDiagnostic.cpp
@@ -265,6 +265,7 @@
     }
     
     SourceMgr.overrideFileContents(File, Buffer);
+    SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User);
   }
 
   // Parse the diagnostics, emitting them one by one until we've