]> granicus.if.org Git - clang/commitdiff
[Serialization] In ASTReader::getInputFile record it when we didn't find the file...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 8 Jan 2014 19:13:34 +0000 (19:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 8 Jan 2014 19:13:34 +0000 (19:13 +0000)
Hopefully addresses rdar://14514222.

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

include/clang/Serialization/Module.h
lib/Serialization/ASTReader.cpp

index 89c604f393ed9b58c060ca20ce1105ee0f6aab59..f4c07553d6bb34a6d42ddefb4e6b4270483d0ae0 100644 (file)
@@ -57,11 +57,12 @@ struct DeclContextInfo {
 
 /// \brief The input file that has been loaded from this AST file, along with
 /// bools indicating whether this was an overridden buffer or if it was
-/// out-of-date.
+/// out-of-date or not-found.
 class InputFile {
   enum {
     Overridden = 1,
-    OutOfDate = 2
+    OutOfDate = 2,
+    NotFound = 3
   };
   llvm::PointerIntPair<const FileEntry *, 2, unsigned> Val;
 
@@ -79,9 +80,16 @@ public:
     Val.setPointerAndInt(File, intVal);
   }
 
+  static InputFile getNotFound() {
+    InputFile File;
+    File.Val.setInt(NotFound);
+    return File;
+  }
+
   const FileEntry *getFile() const { return Val.getPointer(); }
   bool isOverridden() const { return Val.getInt() == Overridden; }
   bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
+  bool isNotFound() const { return Val.getInt() == NotFound; }
 };
 
 /// \brief Information about a module that has been loaded by the ASTReader.
index c531134a9748abca100e64c7a297e08172f344f7..400619f63ab3f04edc3f9a1fc534926cf6f435d8 100644 (file)
@@ -1643,6 +1643,9 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) {
   if (F.InputFilesLoaded[ID-1].getFile())
     return F.InputFilesLoaded[ID-1];
 
+  if (F.InputFilesLoaded[ID-1].isNotFound())
+    return InputFile();
+
   // Go find this input file.
   BitstreamCursor &Cursor = F.InputFilesCursor;
   SavedStreamPosition SavedPosition(Cursor);
@@ -1692,6 +1695,8 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) {
         ErrorStr += "' referenced by AST file";
         Error(ErrorStr.c_str());
       }
+      // Record that we didn't find the file.
+      F.InputFilesLoaded[ID-1] = InputFile::getNotFound();
       return InputFile();
     }