DefaultBool check_InstanceVariableInvalidation;
};
-class IvarInvalidationCheckerImpl :
- public Checker<check::ASTDecl<ObjCImplementationDecl> > {
+class IvarInvalidationCheckerImpl {
typedef llvm::SmallSetVector<const ObjCMethodDecl*, 2> MethodSet;
typedef llvm::DenseMap<const ObjCMethodDecl*,
containsInvalidationMethod(InterfaceD, Info, /*LookForPartial*/ false);
// Report an error in case none of the invalidation methods are declared.
- if (!Info.needsInvalidation() && Filter.check_MissingInvalidationMethod) {
- reportNoInvalidationMethod(FirstIvarDecl, IvarToPopertyMap, InterfaceD,
- /*MissingDeclaration*/ true);
+ if (!Info.needsInvalidation()) {
+ if (Filter.check_MissingInvalidationMethod)
+ reportNoInvalidationMethod(FirstIvarDecl, IvarToPopertyMap, InterfaceD,
+ /*MissingDeclaration*/ true);
+ // If there are no invalidation methods, there is no ivar validation work
+ // to be done.
return;
}
+ // Only check if Ivars are invalidated when InstanceVariableInvalidation
+ // has been requested.
+ if (!Filter.check_InstanceVariableInvalidation)
+ return;
+
// Check that all ivars are invalidated by the invalidation methods.
bool AtImplementationContainsAtLeastOneInvalidationMethod = false;
for (MethodSet::iterator I = Info.InvalidationMethods.begin(),
if (D && D->hasBody()) {
AtImplementationContainsAtLeastOneInvalidationMethod = true;
- // Only check if Ivars are invalidated when InstanceVariableInvalidation
- // has been requested.
- if (!Filter.check_InstanceVariableInvalidation)
- break;
-
// Get a copy of ivars needing invalidation.
IvarSet IvarsI = Ivars;
}
// Report an error in case none of the invalidation methods are implemented.
- if (!AtImplementationContainsAtLeastOneInvalidationMethod &&
- Filter.check_MissingInvalidationMethod)
+ if (!AtImplementationContainsAtLeastOneInvalidationMethod)
reportNoInvalidationMethod(FirstIvarDecl, IvarToPopertyMap, InterfaceD,
/*MissingDeclaration*/ false);
}
@interface MissingInvalidationMethod : Foo <FooBar_Protocol>
@property (assign) MissingInvalidationMethod *foobar15_warn;
-#if RUN_MISSING_INVALIDATION_METHOD
+#if RUN_IVAR_INVALIDATION
// expected-warning@-2 {{Property foobar15_warn needs to be invalidated; no invalidation method is defined in the @implementation for MissingInvalidationMethod}}
#endif
@end
@interface MissingInvalidationMethod2 : Foo <FooBar_Protocol> {
Foo *Ivar1;
-#if RUN_MISSING_INVALIDATION_METHOD
+#if RUN_IVAR_INVALIDATION
// expected-warning@-2 {{Instance variable Ivar1 needs to be invalidated; no invalidation method is defined in the @implementation for MissingInvalidationMethod2}}
#endif
}