[cfe-commits] r160768 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h lib/StaticAnalyzer/Core/Calls.cpp lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp lib/StaticAnalyzer/Core/ExprEngineObjC.cpp test/Analysis/inlining/ test/Analysis/inlining/InlineObjCClassMethod.m
Jordan Rose
jordan_rose at apple.com
Wed Jul 25 21:11:39 PDT 2012
Awesome, that was fast!
On Jul 25, 2012, at 5:27 PM, Anna Zaks <ganna at apple.com> wrote:
> + // This is a calss method.
> + // If we have type info for the receiver class, we are calling via
> + // class name.
Typo: "calss".
> + if (ObjCInterfaceDecl *IDecl = E->getReceiverInterface()) {
> + return LookupClassMethodDefinition(E->getSelector(), IDecl);
> + }
No braces needed, method name could be lowercase (although I did see you're intending to refactor it).
> +// 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.
> + at interface MyClassKT : NSObject
> + at end
> + at interface MyClassKT (MyCatKT)
> ++ (int)getInt;
> + at end
> + at implementation MyClassKT (MyCatKT)
> ++ (int)getInt {
> + return 0;
> +}
> + at end
> + at implementation MyClassKT
> +- (int)testClassMethodByKnownVarDecl {
> + Class currentClass = [self class];
> + int y = [currentClass getInt];
> + return 5/y; // Would be great to get a warning here.
> +}
> + at end
[self class] could be a subclass, so this isn't /exactly/ a false negative.
More information about the cfe-commits
mailing list