[cfe-commits] r159595 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h lib/StaticAnalyzer/Core/ExprEngine.cpp

Jordan Rose jordan_rose at apple.com
Mon Jul 2 14:41:53 PDT 2012


Author: jrose
Date: Mon Jul  2 16:41:53 2012
New Revision: 159595

URL: http://llvm.org/viewvc/llvm-project?rev=159595&view=rev
Log:
Revert "Remove unused member (& consequently unused parameter) in SA's Call code."

...and instead add an accessor. We're not using this today, but it's something
that should probably stay in the source for potential clients, and it doesn't
cost a lot. (ObjCPropertyAccess is only created on the stack, and right now
there's only ever one alive at a time.)

This reverts r159581 / commit 8e674e1da34a131faa7d43dc3fcbd6e49120edbe.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h?rev=159595&r1=159594&r2=159595&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h Mon Jul  2 16:41:53 2012
@@ -405,13 +405,16 @@
 ///
 /// 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 @@
     return EntireRange;
   }
 
+  const ObjCPropertyRefExpr *getPropertyExpr() const {
+    return PropE;
+  }
+
   static bool classof(const CallEvent *CA) {
     return CA->getKind() == CE_ObjCPropertyAccess;
   }

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=159595&r1=159594&r2=159595&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Mon Jul  2 16:41:53 2012
@@ -881,8 +881,9 @@
         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;





More information about the cfe-commits mailing list