[PATCH] D19586: Misleading Indentation check
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 14 01:08:08 PST 2017
xazax.hun added a comment.
Thank you for the review!
================
Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:79
+ Finder->addMatcher(
+ compoundStmt(anyOf(has(ifStmt()), has(forStmt()), has(whileStmt())))
+ .bind("compound"),
----------------
alexfh wrote:
> `has(anyOf(ifStmt(), forStmt(), whileStmt()))` would read better.
I agree but unfortunately that does not compile.
================
Comment at: test/clang-tidy/readability-misleading-indentation.cpp:21
+ foo2();
+ // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: potential dangling 'else' [readability-misleading-indentation]
+
----------------
danielmarjamaki wrote:
> I am skeptic about this warning message.
>
> Why does it say "potential". I would say that in this test case the indentation _is_ "dangling".
>
> The message is not very clear to me. I personally don't intuitively understand what is wrong without looking at the code.
>
> I don't know what it should say. Maybe:
> ```
> different indentation for 'if' and 'else'
> ```
>
Thank you, good idea!
https://reviews.llvm.org/D19586
More information about the cfe-commits
mailing list