[PATCH] D19586: Misleading Indentation check

Nick Lewycky via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 27 13:16:52 PDT 2016


nlewycky added a subscriber: nlewycky.

================
Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:31
@@ +30,3 @@
+      Result.SourceManager->getExpansionColumnNumber(ElseLoc))
+    diag(ElseLoc, "potentional dangling else");
+}
----------------
Typo of "potential" as "potentional".

================
Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:54
@@ +53,3 @@
+
+    if (Result.SourceManager->getExpansionColumnNumber(StmtLoc) ==
+        Result.SourceManager->getExpansionColumnNumber(NextLoc))
----------------
What about a one-line "if (x) foo(); else bar();"? Warn on it anyways?

================
Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:56
@@ +55,3 @@
+        Result.SourceManager->getExpansionColumnNumber(NextLoc))
+      diag(NextLoc, "Wrong Indentation - statement is indentated as a member "
+                    "of if statement");
----------------
Typo of "indented" as "indentated".

================
Comment at: test/clang-tidy/readability-misleading-indentation.cpp:48
@@ +47,3 @@
+   }
+      foo2();  // ok
+
----------------
This is arguably misleading indentation, but I'm ok with not warning on it if you think it will cause too many false positives.


http://reviews.llvm.org/D19586





More information about the cfe-commits mailing list