summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-05-04 03:01:54 +0000
committerRichard Trieu <rtrieu@google.com>2012-05-04 03:01:54 +0000
commit0030f1dbc1ee166a2a7228712d07c3468c5500be (patch)
treeb87d10250cf48aed4478b8f121161695c31fae32 /clang/test
parent75fbe908392ecd432c15c53c361b62cb8fe77fca (diff)
downloadbcm5719-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')
-rw-r--r--clang/test/SemaCXX/warn-loop-analysis.cpp8
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;);
+}
OpenPOWER on IntegriCloud