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

Tyker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 30 03:31:26 PST 2019


Tyker marked an inline comment as done.
Tyker added inline comments.


================
Comment at: clang/lib/Parse/ParseStmt.cpp:1376
+
+    MIChecker.Check(ElseStmt.isUsable());
 
----------------
Tyker wrote:
> xbolva00 wrote:
> > What is wrong with code you used some rev ago?
> > 
> > if (usable) check();
> > 
> > Now you uselessly instantiate MIChecker since if Usable = false, check is not called.
> > 
> > I like the older code more...
> > 
> > If (usable) checkForMisleadingIndention(...) 
> > 
> > Was good and accepted.
> previous patch gave up on else if because we can't know wether there are braces.
> 
> this revision can produce correct diagnostics on else if
the MisleadingIndentationChecker gathers information during its construction this allows having more context and removes many false positives. 

but I can bring back
If (usable) MIChecker.Check(...)


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

https://reviews.llvm.org/D70638





More information about the cfe-commits mailing list