diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-06-30 16:41:03 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-06-30 16:41:03 +0000 |
commit | d395b9344d835eeb25156cfb7a6268ff92bd0e5c (patch) | |
tree | 3d237b0d38ad8535f04641343c0ad2b4df507613 | |
parent | 400d7b9e082fdeb7c6429b5a9e43853ba678bd1c (diff) | |
download | bcm5719-llvm-d395b9344d835eeb25156cfb7a6268ff92bd0e5c.tar.gz bcm5719-llvm-d395b9344d835eeb25156cfb7a6268ff92bd0e5c.zip |
Replace an unreachable error path with an assert
(SourceManager::createFileID cannot return an invalid file ID).
Also update a comment to reflect this.
llvm-svn: 134168
-rw-r--r-- | clang/include/clang/Basic/SourceManager.h | 4 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index 4227add5673..f2a8bf35155 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -500,8 +500,8 @@ public: //===--------------------------------------------------------------------===// /// createFileID - Create a new FileID that represents the specified file - /// being #included from the specified IncludePosition. This returns 0 on - /// error and translates NULL into standard input. + /// being #included from the specified IncludePosition. This translates NULL + /// into standard input. /// PreallocateID should be non-zero to specify which pre-allocated, /// lazily computed source location is being filled in by this operation. FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index b6925b70b70..f74aad3c816 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1208,10 +1208,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // Look up the file, create a File ID for it. FileID FID = SourceMgr.createFileID(File, FilenameTok.getLocation(), FileCharacter); - if (FID.isInvalid()) { - Diag(FilenameTok, diag::err_pp_file_not_found) << Filename; - return; - } + assert(!FID.isInvalid() && "Expected valid file ID"); // Finally, if all is good, enter the new file! EnterSourceFile(FID, CurDir, FilenameTok.getLocation()); |