aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
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
commit9087599e5ee64ecd30194b3d89f8748ac95c62f7 (patch)
treef7ce65f2f3b97e8b4f08d2d20db1d417b794d050 /lib/Sema/SemaStmt.cpp
parentb88acb018a0d5e897ce291da2664edfd7bd58f5c (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 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 66ddbaabf1..2d03ab99ef 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -1214,11 +1214,12 @@ public:
// No decls found.
if (Decls.size() == 0) return;
- // Don't warn on volatile decls.
+ // Don't warn on volatile, static, or global variables.
for (llvm::SmallPtrSet<VarDecl*, 8>::iterator I = Decls.begin(),
E = Decls.end();
I != E; ++I)
- if ((*I)->getType().isVolatileQualified()) return;
+ if ((*I)->getType().isVolatileQualified() ||
+ (*I)->hasGlobalStorage()) return;
if (DeclMatcher(S, Decls, Second).FoundDeclInUse() ||
DeclMatcher(S, Decls, Third).FoundDeclInUse() ||