DIAG(err_attribute_cleanup_func_must_take_one_arg, ERROR,
"'cleanup' function %0 must take 1 parameter")
DIAG(err_attribute_cleanup_func_arg_incompatible_type, ERROR,
- "'cleanup' function %0 parameter has type %1, expected type %2")
-
+ "'cleanup' function %0 parameter has type %1 which is incompatible with "
+ "type %2")
+
// Clang-Specific Attributes
DIAG(err_attribute_iboutlet, ERROR,
"'iboutlet' attribute can only be applied to instance variables or properties")
// If this ever proves to be a problem it should be easy to fix.
QualType Ty = S.Context.getPointerType(VD->getType());
QualType ParamTy = FD->getParamDecl(0)->getType();
- if (Ty != ParamTy) {
+ if (S.CheckAssignmentConstraints(Ty, ParamTy) != Sema::Compatible) {
S.Diag(Attr.getLoc(),
diag::err_attribute_cleanup_func_arg_incompatible_type) <<
Attr.getParameterName() << ParamTy << Ty;
void t2()
{
int v1 __attribute__((cleanup(c2))); // expected-error {{'cleanup' function 'c2' must take 1 parameter}}
- int v2 __attribute__((cleanup(c3))); // expected-error {{'cleanup' function 'c3' parameter has type 'struct s', expected type 'int *'}}
+ int v2 __attribute__((cleanup(c3))); // expected-error {{'cleanup' function 'c3' parameter has type 'struct s' which is incompatible with type 'int *'}}
}
--- /dev/null
+// RUN: clang %s -verify -fsyntax-only
+
+@class NSString;
+
+void c1(id *a);
+
+void t1()
+{
+ NSString *s __attribute((cleanup(c1)));
+}