From 0030f1dbc1ee166a2a7228712d07c3468c5500be Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Fri, 4 May 2012 03:01:54 +0000 Subject: Skip checking for infinite for-loops if there are global or static variables in the conditional. llvm-svn: 156148 --- clang/test/SemaCXX/warn-loop-analysis.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/test/SemaCXX/warn-loop-analysis.cpp') 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;); +} -- cgit v1.2.3