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 | 710bb871478ff60ae81c424218c0ec264beb3e96 (patch) | |
tree | 8fa87a6532c170e184a5cc3dcadf39f702cc509c /clang/lib/Frontend/RewriteMacros.cpp | |
parent | 031cb0024656d7c8ec8da0a58a2ccfa98746149a (diff) | |
download | bcm5719-llvm-710bb871478ff60ae81c424218c0ec264beb3e96.tar.gz bcm5719-llvm-710bb871478ff60ae81c424218c0ec264beb3e96.zip |
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".
llvm-svn: 90110
Diffstat (limited to 'clang/lib/Frontend/RewriteMacros.cpp')
-rw-r--r-- | clang/lib/Frontend/RewriteMacros.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/RewriteMacros.cpp b/clang/lib/Frontend/RewriteMacros.cpp index b5d59c0aa40..0bcbd4ff0ee 100644 --- a/clang/lib/Frontend/RewriteMacros.cpp +++ b/clang/lib/Frontend/RewriteMacros.cpp @@ -65,7 +65,8 @@ static void LexRawTokensFromMainFile(Preprocessor &PP, // Create a lexer to lex all the tokens of the main file in raw mode. Even // though it is in raw mode, it will not return comments. - Lexer RawLex(SM.getMainFileID(), SM, PP.getLangOptions()); + const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID()); + Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOptions()); // Switch on comment lexing because we really do want them. RawLex.SetCommentRetentionState(true); |