/// \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;
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.
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);
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();
}