r191094 - [analyzer] Use getParentIgnoreParenCasts instead of doing it by hand.

Jordan Rose jordan_rose at apple.com
Fri Sep 20 09:51:50 PDT 2013


Author: jrose
Date: Fri Sep 20 11:51:50 2013
New Revision: 191094

URL: http://llvm.org/viewvc/llvm-project?rev=191094&view=rev
Log:
[analyzer] Use getParentIgnoreParenCasts instead of doing it by hand.

Apart from being more compact and already implemented, this also handles the
case where the parent is null. (It does also ignore all casts, not just
implicit ones, but this is more efficient to test and in the case we care
about---a message in a PseudoObjectExpr---there should only be implicit casts
anyway.

This should fix our internal buildbot.

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=191094&r1=191093&r2=191094&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Fri Sep 20 11:51:50 2013
@@ -688,9 +688,7 @@ ObjCMessageKind ObjCMethodCall::getMessa
 
     // Find the parent, ignoring implicit casts.
     ParentMap &PM = getLocationContext()->getParentMap();
-    const Stmt *S = PM.getParent(getOriginExpr());
-    while (isa<ImplicitCastExpr>(S))
-      S = PM.getParent(S);
+    const Stmt *S = PM.getParentIgnoreParenCasts(getOriginExpr());
 
     // Check if parent is a PseudoObjectExpr.
     if (const PseudoObjectExpr *POE = dyn_cast_or_null<PseudoObjectExpr>(S)) {





More information about the cfe-commits mailing list