diff options
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h | 15 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngine.cpp | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h index 86001baffe..f5d6309884 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h @@ -405,13 +405,16 @@ public: /// /// Example: obj.prop += 1; class ObjCPropertyAccess : public ObjCMethodCall { + const ObjCPropertyRefExpr *PropE; SourceRange EntireRange; public: - ObjCPropertyAccess(SourceRange range, const ObjCMessageExpr *Msg, - const ProgramStateRef St, const LocationContext *LCtx) - : ObjCMethodCall(Msg, St, LCtx, CE_ObjCPropertyAccess), EntireRange(range) - {} + ObjCPropertyAccess(const ObjCPropertyRefExpr *pe, SourceRange range, + const ObjCMessageExpr *Msg, const ProgramStateRef St, + const LocationContext *LCtx) + : ObjCMethodCall(Msg, St, LCtx, CE_ObjCPropertyAccess), PropE(pe), + EntireRange(range) + {} /// \brief Returns true if this property access is calling the setter method. bool isSetter() const { @@ -422,6 +425,10 @@ public: return EntireRange; } + const ObjCPropertyRefExpr *getPropertyExpr() const { + return PropE; + } + static bool classof(const CallEvent *CA) { return CA->getKind() == CE_ObjCPropertyAccess; } diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index ae38a12160..63aa28fa0a 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -881,8 +881,9 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(syntactic)) syntactic = BO->getLHS(); - if (isa<ObjCPropertyRefExpr>(syntactic)) { - VisitObjCMessage(ObjCPropertyAccess(PO->getSourceRange(), ME, + if (const ObjCPropertyRefExpr *PR = + dyn_cast<ObjCPropertyRefExpr>(syntactic)) { + VisitObjCMessage(ObjCPropertyAccess(PR, PO->getSourceRange(), ME, Pred->getState(), LCtx), Pred, Dst); evaluated = true; |