[cfe-commits] r92106 - in /cfe/trunk: lib/Analysis/GRExprEngine.cpp test/Analysis/misc-ps-region-store.cpp
Ted Kremenek
kremenek at apple.com
Wed Dec 23 16:54:56 PST 2009
Author: kremenek
Date: Wed Dec 23 18:54:56 2009
New Revision: 92106
URL: http://llvm.org/viewvc/llvm-project?rev=92106&view=rev
Log:
Teach GRExprEngine to handle the initialization of the condition variable of a WhileStmt.
Modified:
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/test/Analysis/misc-ps-region-store.cpp
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=92106&r1=92105&r2=92106&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Dec 23 18:54:56 2009
@@ -751,6 +751,12 @@
VisitUnaryOperator(U, Pred, Dst, false);
break;
}
+
+ case Stmt::WhileStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<WhileStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
}
}
Modified: cfe/trunk/test/Analysis/misc-ps-region-store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.cpp?rev=92106&r1=92105&r2=92106&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.cpp (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.cpp Wed Dec 23 18:54:56 2009
@@ -59,3 +59,18 @@
}
return 0;
}
+
+int test_init_in_condition_while() {
+ int y = 1;
+ while (int x = test_init_in_condition_aux()) { // no-warning
+ if (!x) {
+ y = 0;
+ break;
+ }
+ }
+ if (!y) {
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ }
+ return 0;
+}
More information about the cfe-commits
mailing list