aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 3207062cca..149041559a 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -229,7 +229,14 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
// the token this macro expanded to.
Loc = SM.getInstantiationLoc(Loc);
std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
- std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first);
+ llvm::StringRef FileName;
+ std::string ErrorStr;
+ std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first,
+ FileName,
+ ErrorStr);
+ if (!Buffer.first)
+ return 0;
+
const char *StrData = Buffer.first+LocInfo.second;
if (isWhitespace(StrData[0]))