[clang-tools-extra] afc4958 - [pseudo] Add dangling-else guard to missing if-statement variants
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 27 00:09:24 PDT 2022
Author: Sam McCall
Date: 2022-07-27T09:08:34+02:00
New Revision: afc4958f5ad004309bb982c24147bc3d562add74
URL: https://github.com/llvm/llvm-project/commit/afc4958f5ad004309bb982c24147bc3d562add74
DIFF: https://github.com/llvm/llvm-project/commit/afc4958f5ad004309bb982c24147bc3d562add74.diff
LOG: [pseudo] Add dangling-else guard to missing if-statement variants
Added:
Modified:
clang-tools-extra/pseudo/lib/cxx/CXX.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/pseudo/lib/cxx/CXX.cpp b/clang-tools-extra/pseudo/lib/cxx/CXX.cpp
index fe9eb930469e..a0a252c50b98 100644
--- a/clang-tools-extra/pseudo/lib/cxx/CXX.cpp
+++ b/clang-tools-extra/pseudo/lib/cxx/CXX.cpp
@@ -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.
More information about the cfe-commits
mailing list