aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/TokenRewriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-30 04:18:44 +0000
committerChris Lattner <sabre@nondot.org>2009-11-30 04:18:44 +0000
commit6e2901407bff59aeb4cc301cc58b034723d0eb49 (patch)
tree4deae2d94f73fdf3c0608ac482e7e5666e8c0375 /lib/Rewrite/TokenRewriter.cpp
parent76ed1f76f986a2c052654b81e2ed9dfb86dd79d8 (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/TokenRewriter.cpp')
-rw-r--r--lib/Rewrite/TokenRewriter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Rewrite/TokenRewriter.cpp b/lib/Rewrite/TokenRewriter.cpp
index 0effbb18b8..789d53f4af 100644
--- a/lib/Rewrite/TokenRewriter.cpp
+++ b/lib/Rewrite/TokenRewriter.cpp
@@ -23,7 +23,8 @@ TokenRewriter::TokenRewriter(FileID FID, SourceManager &SM,
ScratchBuf.reset(new ScratchBuffer(SM));
// Create a lexer to lex all the tokens of the main file in raw mode.
- Lexer RawLex(FID, SM, LangOpts);
+ const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID);
+ Lexer RawLex(FID, FromFile, SM, LangOpts);
// Return all comments and whitespace as tokens.
RawLex.SetKeepWhitespaceMode(true);