diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-15 12:27:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-15 13:46:04 +0200 |
commit | 06c281c20654baaabfdb7080a77a350ca789f9b2 (patch) | |
tree | 29ae415fb20863441cbfab4954de9fe2b49bad85 /compilerplugins/clang/test/unusedindex.cxx | |
parent | ca6d205e88f052d25325d360a6fd0d744cb43000 (diff) |
loplugin:unusedindex fix false+ in nested loops
Change-Id: I31acbf104e49a4d1f077817a68d0b116fd2e0a30
Diffstat (limited to 'compilerplugins/clang/test/unusedindex.cxx')
-rw-r--r-- | compilerplugins/clang/test/unusedindex.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unusedindex.cxx b/compilerplugins/clang/test/unusedindex.cxx index 69ad7000b38c..7b98f8645b91 100644 --- a/compilerplugins/clang/test/unusedindex.cxx +++ b/compilerplugins/clang/test/unusedindex.cxx @@ -18,6 +18,22 @@ void func1() n += 1; for (int i = 0; i < 10; ++i) n += i; + + for (int i = 0; i < 10; ++i) // expected-error {{loop variable not used [loplugin:unusedindex]}} + { + for (int j = 0; j < 10; ++j) + { + n += j; + } + } + for (int i = 0; i < 10; ++i) + { + for (int j = 0; j < 10; ++j) + { + n += j; + n += i; + } + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |