summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-04-18 21:45:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-04-18 21:45:04 +0000
commit4c132e576bbd9ad90904ec4ca385cbd7ae06ded2 (patch)
tree02ffbd167a57cce42cee683caacdde83cbbb9173 /clang/lib
parent09bb760baa542aadb0712a34f5bf79c34677845b (diff)
downloadbcm5719-llvm-4c132e576bbd9ad90904ec4ca385cbd7ae06ded2.tar.gz
bcm5719-llvm-4c132e576bbd9ad90904ec4ca385cbd7ae06ded2.zip
Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language.
llvm-svn: 300609
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/Lexer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 5d0fe42defd..dc911ef91b6 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -1171,6 +1171,8 @@ const char *Lexer::SkipEscapedNewLines(const char *P) {
// If not a trigraph for escape, bail out.
if (P[1] != '?' || P[2] != '/')
return P;
+ // FIXME: Take LangOpts into account; the language might not
+ // support trigraphs.
AfterEscape = P+3;
} else {
return P;
@@ -2079,17 +2081,17 @@ bool Lexer::SkipLineComment(Token &Result, const char *CurPtr,
HasSpace = true;
}
- if (*EscapePtr == '\\') // Escaped newline.
+ if (*EscapePtr == '\\')
+ // Escaped newline.
CurPtr = EscapePtr;
else if (EscapePtr[0] == '/' && EscapePtr[-1] == '?' &&
- EscapePtr[-2] == '?') // Trigraph-escaped newline.
+ EscapePtr[-2] == '?' && LangOpts.Trigraphs)
+ // Trigraph-escaped newline.
CurPtr = EscapePtr-2;
else
break; // This is a newline, we're done.
// If there was space between the backslash and newline, warn about it.
- // FIXME: This warning is bogus if trigraphs are disabled and the line
- // ended with '?' '?' '\\' '\n'.
if (HasSpace && !isLexingRawMode())
Diag(EscapePtr, diag::backslash_newline_space);
}
OpenPOWER on IntegriCloud