From 226a56fa1dde6363cc6e246ddc1dda99517e609e Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Tue, 17 Sep 2013 01:30:57 +0000 Subject: [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. llvm-svn: 190836 --- clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 59cdfbb7f9e..4f8683f7853 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -685,8 +685,14 @@ const PseudoObjectExpr *ObjCMethodCall::getContainingPseudoObjectExpr() const { 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(S)) + S = PM.getParent(S); + + // Check if parent is a PseudoObjectExpr. if (const PseudoObjectExpr *POE = dyn_cast_or_null(S)) { const Expr *Syntactic = POE->getSyntacticForm(); -- cgit v1.2.3