[cfe-commits] r106083 - in /cfe/trunk/lib/Checker: AttrNonNullChecker.cpp GRExprEngine.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Tue Jun 15 22:45:09 PDT 2010
Author: zhongxingxu
Date: Wed Jun 16 00:45:09 2010
New Revision: 106083
URL: http://llvm.org/viewvc/llvm-project?rev=106083&view=rev
Log:
Register CallAndMessageChecker before AttrNonNullChecker. Then we can assume
arguments are not undefined.
Modified:
cfe/trunk/lib/Checker/AttrNonNullChecker.cpp
cfe/trunk/lib/Checker/GRExprEngine.cpp
Modified: cfe/trunk/lib/Checker/AttrNonNullChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/AttrNonNullChecker.cpp?rev=106083&r1=106082&r2=106083&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/AttrNonNullChecker.cpp (original)
+++ cfe/trunk/lib/Checker/AttrNonNullChecker.cpp Wed Jun 16 00:45:09 2010
@@ -60,15 +60,11 @@
if (!Att->isNonNull(idx))
continue;
- const SVal &V = state->getSVal(*I);
- const DefinedSVal *DV = dyn_cast<DefinedSVal>(&V);
-
- if (!DV)
- continue;
+ const DefinedSVal &V = cast<DefinedSVal>(state->getSVal(*I));
ConstraintManager &CM = C.getConstraintManager();
const GRState *stateNotNull, *stateNull;
- llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, *DV);
+ llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, V);
if (stateNull && !stateNotNull) {
// Generate an error node. Check for a null node in case
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=106083&r1=106082&r2=106083&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Jun 16 00:45:09 2010
@@ -312,8 +312,10 @@
// automatically. Note that the check itself is owned by the GRExprEngine
// object.
RegisterAdjustedReturnValueChecker(Eng);
- RegisterAttrNonNullChecker(Eng);
+ // CallAndMessageChecker should be registered before AttrNonNullChecker,
+ // where we assume arguments are not undefined.
RegisterCallAndMessageChecker(Eng);
+ RegisterAttrNonNullChecker(Eng);
RegisterDereferenceChecker(Eng);
RegisterVLASizeChecker(Eng);
RegisterDivZeroChecker(Eng);
More information about the cfe-commits
mailing list