summaryrefslogtreecommitdiffstats
path: root/clang/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
commitd20dc870090c9e287ec1d4c617f2f4a94dede7d7 (patch)
tree0ae9ee2c23415894c95b47abe637f9563f2a9c6a /clang/lib/Frontend/PCHReader.cpp
parent6b8f78eb03d9527fbb25716296a44c60430120f0 (diff)
downloadbcm5719-llvm-d20dc870090c9e287ec1d4c617f2f4a94dede7d7.tar.gz
bcm5719-llvm-d20dc870090c9e287ec1d4c617f2f4a94dede7d7.zip
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 llvm-svn: 73371
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 87fc8394c8d..8ea917c3e34 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/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],
OpenPOWER on IntegriCloud