summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-06-21 00:35:03 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-06-21 00:35:03 +0000
commitd0124578ee0fbed8d6a3f38a1092e325492b31a7 (patch)
treee030d188cfaab98c6c598d5c6e0caa4ef135f0e5 /clang/lib/Lex
parent7bedfda4897d8804f0e4eb150635d274d67d969f (diff)
downloadbcm5719-llvm-d0124578ee0fbed8d6a3f38a1092e325492b31a7.tar.gz
bcm5719-llvm-d0124578ee0fbed8d6a3f38a1092e325492b31a7.zip
Do not complain about junk on the end of a #endif in a skipped block. Such junk
is permitted by all relevant language standards. Patch by Andy Gibbs! llvm-svn: 158883
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 5c03c97b7c3..8f79796c58c 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -317,7 +317,6 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
} else if (Directive[0] == 'e') {
StringRef Sub = Directive.substr(1);
if (Sub == "ndif") { // "endif"
- CheckEndOfDirective("endif");
PPConditionalInfo CondInfo;
CondInfo.WasSkipping = true; // Silence bogus warning.
bool InCond = CurPPLexer->popConditionalLevel(CondInfo);
@@ -326,9 +325,12 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
// If we popped the outermost skipping block, we're done skipping!
if (!CondInfo.WasSkipping) {
+ CheckEndOfDirective("endif");
if (Callbacks)
Callbacks->Endif(Tok.getLocation(), CondInfo.IfLoc);
break;
+ } else {
+ DiscardUntilEndOfDirective();
}
} else if (Sub == "lse") { // "else".
// #else directive in a skipping conditional. If not in some other
OpenPOWER on IntegriCloud