Skip to content

Commit

Permalink
[pseudo] Add dangling-else guard to missing if-statement variants
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-mccall committed Jul 27, 2022
1 parent 89f284b commit afc4958
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clang-tools-extra/pseudo/lib/cxx/CXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,17 @@ llvm::DenseMap<ExtensionID, RuleGuard> buildGuards() {
{rule::contextual_zero::NUMERIC_CONSTANT,
TOKEN_GUARD(numeric_constant, Tok.text() == "0")},

// FIXME: the init-statement variants are missing?
{rule::selection_statement::IF__L_PAREN__condition__R_PAREN__statement,
guardNextTokenNotElse},
{rule::selection_statement::
IF__L_PAREN__init_statement__condition__R_PAREN__statement,
guardNextTokenNotElse},
{rule::selection_statement::
IF__CONSTEXPR__L_PAREN__condition__R_PAREN__statement,
guardNextTokenNotElse},
{rule::selection_statement::
IF__CONSTEXPR__L_PAREN__init_statement__condition__R_PAREN__statement,
guardNextTokenNotElse},

// The grammar distinguishes (only) user-defined vs plain string literals,
// where the clang lexer distinguishes (only) encoding types.
Expand Down

0 comments on commit afc4958

Please sign in to comment.