Stop parsing into IfConfiDecl nodes in the C++ parser

When parsing #if...#endif regions, parse the active clause directly into
place in the AST without ever producing an IfConfigDecl instance.
This commit is contained in:
Doug Gregor
2024-09-18 20:20:00 -07:00
parent 4bb9a587fa
commit d762dd53f8
11 changed files with 105 additions and 115 deletions

View File

@@ -822,9 +822,11 @@ bool Parser::parseEndIfDirective(SourceLoc &Loc) {
Loc = PreviousLoc;
skipUntilConditionalBlockClose();
return true;
} else if (!Tok.isAtStartOfLine() && Tok.isNot(tok::eof))
} else if (!Tok.isAtStartOfLine() && Tok.isNot(tok::eof)) {
diagnose(Tok.getLoc(),
diag::extra_tokens_conditional_compilation_directive);
skipUntilTokenOrEndOfLine(tok::NUM_TOKENS);
}
return false;
}