diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-02 19:27:35 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-02 19:27:35 +0000 |
commit | 742920c8e7466e72220c571536e0aea21890233c (patch) | |
tree | c571300efbe4a1ee4119b3c90322cac455839944 /clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | |
parent | 442dd80715f71bd8118dc44b521f0e0bb35a697d (diff) | |
download | bcm5719-llvm-742920c8e7466e72220c571536e0aea21890233c.tar.gz bcm5719-llvm-742920c8e7466e72220c571536e0aea21890233c.zip |
[analyzer] Add a new abstraction over all types of calls: CallEvent
This is intended to replace CallOrObjCMessage, and is eventually intended to be
used for anything that cares more about /what/ is being called than /how/ it's
being called. For example, inlining destructors should be the same as inlining
blocks, and checking __attribute__((nonnull)) should apply to the allocator
calls generated by operator new.
llvm-svn: 159554
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp index be9a26b1f5b..d35d999b5e9 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp @@ -13,6 +13,7 @@ #include "clang/AST/StmtObjC.h" #include "clang/StaticAnalyzer/Core/CheckerManager.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/Calls.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h" @@ -246,6 +247,9 @@ void ExprEngine::evalObjCMessage(StmtNodeBuilder &Bldr, ExplodedNode *Pred, ProgramStateRef state, bool GenSink) { + const LocationContext *LCtx = Pred->getLocationContext(); + unsigned BlockCount = currentBuilderContext->getCurrentBlockCount(); + // First handle the return value. SVal ReturnValue = UnknownVal(); @@ -259,7 +263,7 @@ void ExprEngine::evalObjCMessage(StmtNodeBuilder &Bldr, // These methods return their receivers. const Expr *ReceiverE = msg.getInstanceReceiver(); if (ReceiverE) - ReturnValue = state->getSVal(ReceiverE, Pred->getLocationContext()); + ReturnValue = state->getSVal(ReceiverE, LCtx); break; } } @@ -268,18 +272,17 @@ void ExprEngine::evalObjCMessage(StmtNodeBuilder &Bldr, if (ReturnValue.isUnknown()) { SValBuilder &SVB = getSValBuilder(); QualType ResultTy = msg.getResultType(getContext()); - unsigned Count = currentBuilderContext->getCurrentBlockCount(); const Expr *CurrentE = cast<Expr>(currentStmt); - const LocationContext *LCtx = Pred->getLocationContext(); - ReturnValue = SVB.getConjuredSymbolVal(NULL, CurrentE, LCtx, ResultTy, Count); + ReturnValue = SVB.getConjuredSymbolVal(NULL, CurrentE, LCtx, ResultTy, + BlockCount); } // Bind the return value. - const LocationContext *LCtx = Pred->getLocationContext(); state = state->BindExpr(currentStmt, LCtx, ReturnValue); // Invalidate the arguments (and the receiver) - state = invalidateArguments(state, CallOrObjCMessage(msg, state, LCtx), LCtx); + ObjCMessageInvocation Invocation(msg, state, LCtx); + state = Invocation.invalidateRegions(BlockCount); // And create the new node. Bldr.generateNode(msg.getMessageExpr(), Pred, state, GenSink); |