aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-15 04:35:16 +0000
committerChris Lattner <sabre@nondot.org>2009-06-15 04:35:16 +0000
commitd3555ae09f3d31f7cac84a85d3915459fd34c657 (patch)
treea0bfe23bdb0bfe4eca3dceaf4b869371479eba68 /lib/Frontend/PCHReader.cpp
parentb1526f311f124dafc03a8e44d3bd8785fd10e267 (diff)
If PCH refers to a file that doesn't exist anymore, emit a nice error
like: fatal error: could not find file '1.h' referenced by PCH file instead of aborting with an assertion failure, PR4219 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 87fc8394c8..8ea917c3e3 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -804,9 +804,16 @@ PCHReader::PCHReadResult PCHReader::ReadSLocEntryRecord(unsigned ID) {
return Failure;
case pch::SM_SLOC_FILE_ENTRY: {
- const FileEntry *File
- = PP.getFileManager().getFile(BlobStart, BlobStart + BlobLen);
- // FIXME: Error recovery if file cannot be found.
+ const FileEntry *File = PP.getFileManager().getFile(BlobStart,
+ BlobStart + BlobLen);
+ if (File == 0) {
+ std::string ErrorStr = "could not find file '";
+ ErrorStr.append(BlobStart, BlobLen);
+ ErrorStr += "' referenced by PCH file";
+ Error(ErrorStr.c_str());
+ return Failure;
+ }
+
FileID FID = SourceMgr.createFileID(File,
SourceLocation::getFromRawEncoding(Record[1]),
(SrcMgr::CharacteristicKind)Record[2],