From 6fbe0317aa38dbac22a29f7519c52db838aa1990 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 27 Jul 2012 19:07:32 +0000 Subject: [PATCH] [analyzer] Address Jordan's and Fariborz's review of r160768. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160883 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h | 8 ++++---- test/Analysis/inlining/InlineObjCClassMethod.m | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h index a366c07481..2661e62403 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -652,17 +652,17 @@ public: // getting the parameters). Currently, this gets called 3 times during // inlining. virtual const Decl *getRuntimeDefinition() const { - const ObjCMessageExpr *E = getOriginExpr(); + assert(E); + if (E->isInstanceMessage()) { return 0; } else { - // This is a calss method. + // This is a class method. // If we have type info for the receiver class, we are calling via // class name. - if (ObjCInterfaceDecl *IDecl = E->getReceiverInterface()) { + if (ObjCInterfaceDecl *IDecl = E->getReceiverInterface()) return LookupClassMethodDefinition(E->getSelector(), IDecl); - } } return 0; diff --git a/test/Analysis/inlining/InlineObjCClassMethod.m b/test/Analysis/inlining/InlineObjCClassMethod.m index 0765251550..8c0e733fc5 100644 --- a/test/Analysis/inlining/InlineObjCClassMethod.m +++ b/test/Analysis/inlining/InlineObjCClassMethod.m @@ -114,6 +114,7 @@ int foo() { // False negative. // ObjC class method call through a decl with a known type. // We should be able to track the type of currentClass and inline this call. +// Note, [self class] could be a subclass. Do we still want to inline here? @interface MyClassKT : NSObject @end @interface MyClassKT (MyCatKT) -- 2.40.0