diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-28 11:07:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-01 10:23:53 +0200 |
commit | 9fbedb7929936a45967ae49bc15b985f95e2ebd3 (patch) | |
tree | bf7fdd4e32e20b87479f083907633a8e63aab29f /compilerplugins/clang/test/blockblock.cxx | |
parent | 0f55c0afbdc1ed60bfa6f4af8f3ccfc0c90db2e4 (diff) |
improve loplugin:blockblock
look for nested blocks where the inner block also contains a break
statement.
Change-Id: I1e5b6ca4c42b995c9479a68b34a1e2f1eb015f57
Reviewed-on: https://gerrit.libreoffice.org/74946
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test/blockblock.cxx')
-rw-r--r-- | compilerplugins/clang/test/blockblock.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/blockblock.cxx b/compilerplugins/clang/test/blockblock.cxx index bd48ed7d38fa..422430f9c1cd 100644 --- a/compilerplugins/clang/test/blockblock.cxx +++ b/compilerplugins/clang/test/blockblock.cxx @@ -21,6 +21,22 @@ int f(bool b1, bool b2) { return 1; } +void foo(int x) +{ + switch (x) + { + case 1: break; + case 2: {} break; + case 3: + { // expected-error {{block directly inside block [loplugin:blockblock]}} + { + } + break; + } + } +} + + int main() { // expected-error {{block directly inside block [loplugin:blockblock]}} { // expected-note {{inner block here [loplugin:blockblock]}} int x = 1; |