[cfe-commits] r76483 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Mon Jul 20 14:43:20 PDT 2009
Author: kremenek
Date: Mon Jul 20 16:43:20 2009
New Revision: 76483
URL: http://llvm.org/viewvc/llvm-project?rev=76483&view=rev
Log:
Enhance GRExprEngine::EvalBind to handle some implicit casts from nonlocs to
locs and vis versa.
Modified:
cfe/trunk/lib/Analysis/GRExprEngine.cpp
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=76483&r1=76482&r2=76483&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Mon Jul 20 16:43:20 2009
@@ -1049,7 +1049,24 @@
else {
// We are binding to a value other than 'unknown'. Perform the binding
// using the StoreManager.
- newState = state->bindLoc(cast<Loc>(location), Val);
+ Loc L = cast<Loc>(location);
+
+ // Handle implicit casts not reflected in the AST. This can be due to
+ // custom checker logic such as what handles OSAtomicCompareAndSwap.
+ if (!Val.isUnknownOrUndef())
+ if (const TypedRegion *R =
+ dyn_cast_or_null<TypedRegion>(L.getAsRegion())) {
+ assert(R->isBoundable());
+ QualType ValTy = R->getValueType(getContext());
+ if (Loc::IsLocType(ValTy)) {
+ if (!isa<Loc>(Val))
+ Val = SVator.EvalCastNL(cast<NonLoc>(Val), ValTy);
+ }
+ else if (!isa<NonLoc>(Val))
+ Val = SVator.EvalCastL(cast<Loc>(Val), ValTy);
+ }
+
+ newState = state->bindLoc(L, Val);
}
// The next thing to do is check if the GRTransferFuncs object wants to
More information about the cfe-commits
mailing list