aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-16 22:30:13 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-16 22:30:13 +0000
commit453091cc2082e207ea2c2dda645a9bc01b37fb0c (patch)
tree96026d218bae429d6706d3783cd94e86b578dc47 /lib/Lex/Lexer.cpp
parenta98c27ba83d25d878473ed8c6a34b40b27d323fd (diff)
Audit all Preprocessor::getSpelling() callers, improving failure
recovery for those that need it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r--lib/Lex/Lexer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 0b8b6242db..60a1707fb3 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -1037,7 +1037,11 @@ bool Lexer::SaveBCPLComment(Token &Result, const char *CurPtr) {
// If this BCPL-style comment is in a macro definition, transmogrify it into
// a C-style block comment.
- std::string Spelling = PP->getSpelling(Result);
+ bool Invalid = false;
+ std::string Spelling = PP->getSpelling(Result, &Invalid);
+ if (Invalid)
+ return true;
+
assert(Spelling[0] == '/' && Spelling[1] == '/' && "Not bcpl comment?");
Spelling[1] = '*'; // Change prefix to "/*".
Spelling += "*/"; // add suffix.