Skip to content

Commit afc4958

Browse files
committed
[pseudo] Add dangling-else guard to missing if-statement variants
1 parent 89f284b commit afc4958

File tree

1 file changed

+6
-1
lines changed
  • clang-tools-extra/pseudo/lib/cxx

1 file changed

+6
-1
lines changed

clang-tools-extra/pseudo/lib/cxx/CXX.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,17 @@ llvm::DenseMap<ExtensionID, RuleGuard> buildGuards() {
300300
{rule::contextual_zero::NUMERIC_CONSTANT,
301301
TOKEN_GUARD(numeric_constant, Tok.text() == "0")},
302302

303-
// FIXME: the init-statement variants are missing?
304303
{rule::selection_statement::IF__L_PAREN__condition__R_PAREN__statement,
305304
guardNextTokenNotElse},
305+
{rule::selection_statement::
306+
IF__L_PAREN__init_statement__condition__R_PAREN__statement,
307+
guardNextTokenNotElse},
306308
{rule::selection_statement::
307309
IF__CONSTEXPR__L_PAREN__condition__R_PAREN__statement,
308310
guardNextTokenNotElse},
311+
{rule::selection_statement::
312+
IF__CONSTEXPR__L_PAREN__init_statement__condition__R_PAREN__statement,
313+
guardNextTokenNotElse},
309314

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

0 commit comments

Comments
 (0)