r198781 - [Serialization] In ASTReader::getInputFile record it when we didn't find the file to avoid looking it up again.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Jan 8 11:13:35 PST 2014
Author: akirtzidis
Date: Wed Jan 8 13:13:34 2014
New Revision: 198781
URL: http://llvm.org/viewvc/llvm-project?rev=198781&view=rev
Log:
[Serialization] In ASTReader::getInputFile record it when we didn't find the file to avoid looking it up again.
Hopefully addresses rdar://14514222.
Modified:
cfe/trunk/include/clang/Serialization/Module.h
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/include/clang/Serialization/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/Module.h?rev=198781&r1=198780&r2=198781&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/Module.h (original)
+++ cfe/trunk/include/clang/Serialization/Module.h Wed Jan 8 13:13:34 2014
@@ -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.
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=198781&r1=198780&r2=198781&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Jan 8 13:13:34 2014
@@ -1643,6 +1643,9 @@ InputFile ASTReader::getInputFile(Module
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(Module
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();
}
More information about the cfe-commits
mailing list