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/Rewrite/HTMLRewrite.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/Rewrite/HTMLRewrite.cpp')
-rw-r--r-- | lib/Rewrite/HTMLRewrite.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index b4bf419bc5..342b0e6ef5 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -353,7 +353,8 @@ void html::SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP) { RewriteBuffer &RB = R.getEditBuffer(FID); const SourceManager &SM = PP.getSourceManager(); - Lexer L(FID, SM, PP.getLangOptions()); + const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); + Lexer L(FID, FromFile, SM, PP.getLangOptions()); const char *BufferStart = L.getBufferStart(); // Inform the preprocessor that we want to retain comments as tokens, so we @@ -444,7 +445,8 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) { const SourceManager &SM = PP.getSourceManager(); std::vector<Token> TokenStream; - Lexer L(FID, SM, PP.getLangOptions()); + const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); + Lexer L(FID, FromFile, SM, PP.getLangOptions()); // Lex all the tokens in raw mode, to avoid entering #includes or expanding // macros. |