summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/indentation.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test/indentation.cxx')
-rw-r--r--compilerplugins/clang/test/indentation.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/indentation.cxx b/compilerplugins/clang/test/indentation.cxx
index 27e858fb319c..e0e25884eebb 100644
--- a/compilerplugins/clang/test/indentation.cxx
+++ b/compilerplugins/clang/test/indentation.cxx
@@ -38,6 +38,39 @@ void top1(int x) {
case 2: foo(); break; // 1expected-error {{statement mis-aligned compared to neighbours [loplugin:indentation]}}
};
+
+ if (x)
+ foo(); // expected-error {{if body should be indented [loplugin:indentation]}}
+
+ if (x)
+ {
+ foo();
+ }
+
+ if (x)
+ ;
+ else
+ foo(); // expected-error {{else body should be indented [loplugin:indentation]}}
+
+ if (x)
+ ;
+ else
+ {
+ foo();
+ }
+
+ if (x)
+ ;
+ else // expected-error {{if and else not aligned [loplugin:indentation]}}
+ foo();
+
+ if (x)
+ {
+ } else
+ {
+ foo();
+ }
+
#if 0
if (x)
foo();