aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
commitc3b054d250cdca485c71845089c316e10610ebad (patch)
treeabae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /lib/Lex/PPDirectives.cpp
parentbca07a4524feb4edec581062d631a13116320a24 (diff)
downloadsrc-c3b054d250cdca485c71845089c316e10610ebad.tar.gz
src-c3b054d250cdca485c71845089c316e10610ebad.zip
Notes
Diffstat (limited to 'lib/Lex/PPDirectives.cpp')
-rw-r--r--lib/Lex/PPDirectives.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 0f0d25b887af..3e871ae7ab47 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -86,6 +86,7 @@ void Preprocessor::DiscardUntilEndOfDirective() {
Token Tmp;
do {
LexUnexpandedToken(Tmp);
+ assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive tokens");
} while (Tmp.isNot(tok::eom));
}
@@ -167,10 +168,12 @@ void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) {
if (Tmp.isNot(tok::eom)) {
// Add a fixit in GNU/C99/C++ mode. Don't offer a fixit for strict-C89,
- // because it is more trouble than it is worth to insert /**/ and check that
- // there is no /**/ in the range also.
+ // or if this is a macro-style preprocessing directive, because it is more
+ // trouble than it is worth to insert /**/ and check that there is no /**/
+ // in the range also.
FixItHint Hint;
- if (Features.GNUMode || Features.C99 || Features.CPlusPlus)
+ if ((Features.GNUMode || Features.C99 || Features.CPlusPlus) &&
+ !CurTokenLexer)
Hint = FixItHint::CreateInsertion(Tmp.getLocation(),"//");
Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << Hint;
DiscardUntilEndOfDirective();