[PATCH] D70638: [Diagnostic] add a warning which warns about misleading indentation

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 1 08:36:09 PST 2019


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParseStmt.cpp:1369-1370
         /*ShouldEnter=*/ConstexprCondition && *ConstexprCondition);
-    ElseStmt = ParseStatement();
+    if (Tok.is(tok::kw_if))
+      ElseStmt = ParseIfStatement(nullptr, ElseLoc);
+    else
----------------
This looks incorrect to me. Consider a case like:
```
if (0) {
} else [[gsl::suppress("foo")]] if (1) {
}
```
I'm a little uneasy calling anything but `ParseStatement()` here as that is what needs to be parsed at this stage.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70638/new/

https://reviews.llvm.org/D70638





More information about the cfe-commits mailing list