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 | 0030f1dbc1ee166a2a7228712d07c3468c5500be (patch) | |
tree | b87d10250cf48aed4478b8f121161695c31fae32 /clang/test/SemaCXX/warn-loop-analysis.cpp | |
parent | 75fbe908392ecd432c15c53c361b62cb8fe77fca (diff) | |
download | bcm5719-llvm-0030f1dbc1ee166a2a7228712d07c3468c5500be.tar.gz bcm5719-llvm-0030f1dbc1ee166a2a7228712d07c3468c5500be.zip |
Skip checking for infinite for-loops if there are global or static variables
in the conditional.
llvm-svn: 156148
Diffstat (limited to 'clang/test/SemaCXX/warn-loop-analysis.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-loop-analysis.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-loop-analysis.cpp b/clang/test/SemaCXX/warn-loop-analysis.cpp index a55ca6c6eac..627bc51d1b0 100644 --- a/clang/test/SemaCXX/warn-loop-analysis.cpp +++ b/clang/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;); +} |