xazax.hun added inline comments.
Comment at: test/clang-tidy/readability-misleading-indentation.cpp:16
@@ +15,3 @@
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: wrong indentation,
'else' belongs to 'if(cond2)' statement
+ // CHECK-FIXES: {{^}} // commen
Pajesz marked 12 inline comments as done.
Pajesz added a comment.
so i have to submit K good to know
Comment at: test/clang-tidy/readability-misleading-indentation.cpp:48
@@ +47,3 @@
+ }
+ foo2(); // ok
+
nlewycky wrote:
> This is arguably misleading ind
alexfh added a comment.
Please mark all addressed comments "Done".
Comment at: test/clang-tidy/readability-misleading-indentation.cpp:15
@@ +14,3 @@
+ foo2(); // comment
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: wrong indentation,
'else' belongs to 'if(con
Pajesz updated this revision to Diff 63925.
Pajesz added a comment.
Minor changes in tests and doc and diff should be full now.
http://reviews.llvm.org/D19586
Files:
clang-tidy/readability/CMakeLists.txt
clang-tidy/readability/MisleadingIndentationCheck.cpp
clang-tidy/readability/Misleadi
alexfh added a comment.
Gergely, it seems that the last diff is missing
clang-tidy/readability/MisleadingIndentationCheck.cpp. A few more comments
below.
Comment at: docs/clang-tidy/checks/readability-misleading-indentation.rst:13
@@ +12,3 @@
+
+The way to avoid dangling else
Pajesz updated this revision to Diff 61651.
Pajesz added a comment.
Checker now works with for and while statements as well, new tests were added,
other syntactical and logical updates have been made.
http://reviews.llvm.org/D19586
Files:
clang-tidy/readability/MisleadingIndentationCheck.h
etienneb added a comment.
In http://reviews.llvm.org/D19586#417063, @xazax.hun wrote:
> In http://reviews.llvm.org/D19586#417053, @etienneb wrote:
>
> > The rule also apply for statements in a same compound:
> >
> > {
> > statement1();
> > statement2();
> > statement3();
> >
> >
>
xazax.hun added a comment.
In http://reviews.llvm.org/D19586#417053, @etienneb wrote:
> The rule also apply for statements in a same compound:
>
> {
> statement1();
> statement2();
> statement3();
>
>
> But this can be a further improvement.
I believe this might be an intentiona
etienneb added a comment.
You should not limit the checker to "if".
The for-statement and while-statement are also wrong for the same reasons:
while (x)
statement1();
statement2();
for (...)
statement1();
statement2();
You should test your code over large code base.
You sh
etienneb requested changes to this revision.
etienneb added a comment.
This revision now requires changes to proceed.
Could you lift some logics to the matcher instead of the check.
Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:22
@@ +21,3 @@
+const Match
Pajesz updated this revision to Diff 55389.
Pajesz marked 5 inline comments as done.
Pajesz added a comment.
Both dangling else and the other check now ignore one-line if-else statements.
Corrected other reviews as well.
http://reviews.llvm.org/D19586
Files:
clang-tidy/readability/CMakeLists
xazax.hun added a comment.
In http://reviews.llvm.org/D19586#415123, @Pajesz wrote:
> Both dangling else and the other check now ignore one-line if-else
> statements. Corrected other reviews as well.
I can not see a test case for one line if-then-else. Could you add it?
http://reviews.llvm.o
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 "pote
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.
Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).
What about for ans while statements?
Comment at: docs/clang-tidy/checks:10
@@ +9,3 @@
+
+The way to avoid dangling else
Pajesz updated this revision to Diff 55247.
Pajesz added a comment.
Probably fixed the broken patch.
http://reviews.llvm.org/D19586
Files:
clang-tidy/readability/CMakeLists.txt
clang-tidy/readability/MisleadingIndentationCheck.cpp
clang-tidy/readability/MisleadingIndentationCheck.h
clan
alexfh added a comment.
The patch is broken:
Index: clang-tidy/readability/Mislead
===
--- /dev/null
+++ clang-tidy/readability/Mislead
@@ -0,0 +1,77 @@
+//===--- MisleadingIndentationCheck.cpp -
clang-tidy--
16 matches
Mail list logo