aboutsummaryrefslogtreecommitdiff
path: root/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Lex/Preprocessor.cpp')
-rw-r--r--Lex/Preprocessor.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 2067a0bc4a..ceab0ba1e7 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -217,7 +217,13 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
// table, which is very quick.
if (const IdentifierInfo *II = Tok.getIdentifierInfo()) {
Buffer = II->getName();
- return Tok.getLength();
+
+ // Return the length of the token. If the token needed cleaning, don't
+ // include the size of the newlines or trigraphs in it.
+ if (!Tok.needsCleaning())
+ return Tok.getLength();
+ else
+ return strlen(Buffer);
}
// Otherwise, compute the start of the token in the input lexer buffer.