r190836 - [analyzer] More reliably detect property accessors.
Anna Zaks
ganna at apple.com
Mon Sep 16 18:30:57 PDT 2013
Author: zaks
Date: Mon Sep 16 20:30:57 2013
New Revision: 190836
URL: http://llvm.org/viewvc/llvm-project?rev=190836&view=rev
Log:
[analyzer] More reliably detect property accessors.
This has a side effect of preventing a crash, which occurs because we get a
property getter declaration, which is overriding but is declared inside
@protocol. Will file a bug about this inconsistency internally. Getting a
small test case is very challenging.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp?rev=190836&r1=190835&r2=190836&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Mon Sep 16 20:30:57 2013
@@ -685,8 +685,14 @@ const PseudoObjectExpr *ObjCMethodCall::
ObjCMessageKind ObjCMethodCall::getMessageKind() const {
if (Data == 0) {
+
+ // Find the parent, ignoring implicit casts.
ParentMap &PM = getLocationContext()->getParentMap();
const Stmt *S = PM.getParent(getOriginExpr());
+ while (isa<ImplicitCastExpr>(S))
+ S = PM.getParent(S);
+
+ // Check if parent is a PseudoObjectExpr.
if (const PseudoObjectExpr *POE = dyn_cast_or_null<PseudoObjectExpr>(S)) {
const Expr *Syntactic = POE->getSyntacticForm();
More information about the cfe-commits
mailing list