diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-30 04:18:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-30 04:18:44 +0000 |
commit | 6e2901407bff59aeb4cc301cc58b034723d0eb49 (patch) | |
tree | 4deae2d94f73fdf3c0608ac482e7e5666e8c0375 /lib/Frontend/VerifyDiagnosticsClient.cpp | |
parent | 76ed1f76f986a2c052654b81e2ed9dfb86dd79d8 (diff) |
Fix PR5633 by making the preprocessor handle the case where we can
stat a file but where mmaping it fails. In this case, we emit an
error like:
t.c:1:10: fatal error: error opening file '../../foo.h'
instead of "cannot find file".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/VerifyDiagnosticsClient.cpp')
-rw-r--r-- | lib/Frontend/VerifyDiagnosticsClient.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Frontend/VerifyDiagnosticsClient.cpp b/lib/Frontend/VerifyDiagnosticsClient.cpp index 2891aec504..99ec910be0 100644 --- a/lib/Frontend/VerifyDiagnosticsClient.cpp +++ b/lib/Frontend/VerifyDiagnosticsClient.cpp @@ -164,12 +164,14 @@ static void FindExpectedDiags(Preprocessor &PP, DiagList &ExpectedNotes) { // Create a raw lexer to pull all the comments out of the main file. We don't // want to look in #include'd headers for expected-error strings. - FileID FID = PP.getSourceManager().getMainFileID(); - if (PP.getSourceManager().getMainFileID().isInvalid()) + SourceManager &SM = PP.getSourceManager(); + FileID FID = SM.getMainFileID(); + if (SM.getMainFileID().isInvalid()) return; // Create a lexer to lex all the tokens of the main file in raw mode. - Lexer RawLex(FID, PP.getSourceManager(), PP.getLangOptions()); + const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); + Lexer RawLex(FID, FromFile, SM, PP.getLangOptions()); // Return comments as tokens, this is how we find expected diagnostics. RawLex.SetCommentRetentionState(true); |