summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2017-03-17 09:58:30 +0000
committerAlexander Kornienko <alexfh@google.com>2017-03-17 09:58:30 +0000
commitbc8d14669df5faee9d31ddb9c2abcf432621560c (patch)
tree1282ae242a1db307490d6fc3ae305042384d57d7 /clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp
parent225b79524de987d810f4085e6a1bf61a289e4adf (diff)
downloadbcm5719-llvm-bc8d14669df5faee9d31ddb9c2abcf432621560c.tar.gz
bcm5719-llvm-bc8d14669df5faee9d31ddb9c2abcf432621560c.zip
[clang-tidy] readability-misleading-indentation: fix chained if
Summary: Fixed erroneously flagging of chained if statements when styled like this: ``` if (cond) { } else if (cond) { } else { } ``` Reviewers: xazax.hun, alexfh Reviewed By: xazax.hun, alexfh Subscribers: JDevlieghere, cfe-commits Patch by Florian Gross! Differential Revision: https://reviews.llvm.org/D30841 llvm-svn: 298059
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp b/clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp
index cb81a57f609..ef94229fcb0 100644
--- a/clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp
+++ b/clang-tools-extra/test/clang-tidy/readability-misleading-indentation.cpp
@@ -76,5 +76,31 @@ int main()
{
}
+ if(cond1) {
+ }
+ else if (cond2) {
+ }
+ else {
+ }
+
+ if(cond1) {
+ }
+ else if (cond2) {
+ }
+ else {
+ }
+ // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
+
+ if (cond1) {
+ if (cond1) {
+ }
+ else if (cond2) {
+ }
+ else {
+ }
+ }
+ else if (cond2) {
+ }
+
BLOCK
}
OpenPOWER on IntegriCloud