diff options
author | Richard Trieu <rtrieu@google.com> | 2012-05-04 03:01:54 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2012-05-04 03:01:54 +0000 |
commit | 9087599e5ee64ecd30194b3d89f8748ac95c62f7 (patch) | |
tree | f7ce65f2f3b97e8b4f08d2d20db1d417b794d050 /test/SemaCXX/warn-loop-analysis.cpp | |
parent | b88acb018a0d5e897ce291da2664edfd7bd58f5c (diff) |
Skip checking for infinite for-loops if there are global or static variables
in the conditional.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-loop-analysis.cpp')
-rw-r--r-- | test/SemaCXX/warn-loop-analysis.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-loop-analysis.cpp b/test/SemaCXX/warn-loop-analysis.cpp index a55ca6c6ea..627bc51d1b 100644 --- a/test/SemaCXX/warn-loop-analysis.cpp +++ b/test/SemaCXX/warn-loop-analysis.cpp @@ -144,3 +144,11 @@ void test5() { for (int a; a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a+a;);//\ // expected-warning {{variable 'a' used in loop condition not modified in loop body}} } + +// Ignore global variables and static variables. +int x6; +void test6() { + static int y; + for (;x6;); + for (;y;); +} |