From 2620a06fe73caee0ca4c8bf6106ce0b5d925e021 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 17 Feb 2009 22:20:20 +0000 Subject: [PATCH] Attribute 'iboutlet' can be applied to Objective-C property declarations. llvm-svn: 64831 --- clang/include/clang/Basic/DiagnosticSemaKinds.def | 4 ++-- clang/lib/Sema/SemaDeclAttr.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.def b/clang/include/clang/Basic/DiagnosticSemaKinds.def index 11db059c269d..19d9b65ffaad 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.def +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.def @@ -410,8 +410,8 @@ DIAG(err_attribute_cleanup_func_arg_incompatible_type, ERROR, "'cleanup' function %0 parameter has type %1, expected type %2") // Clang-Specific Attributes -DIAG(err_attribute_iboutlet_non_ivar, ERROR, - "'iboutlet' attribute can only be applied to instance variables") +DIAG(err_attribute_iboutlet, ERROR, + "'iboutlet' attribute can only be applied to instance variables or properties") DIAG(err_attribute_overloadable_not_function, ERROR, "'overloadable' attribute can only be applied to a function") DIAG(err_attribute_overloadable_missing, ERROR, diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 1d83605316ce..c4caec4d425a 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -287,10 +287,10 @@ static void HandleIBOutletAttr(Decl *d, const AttributeList &Attr, Sema &S) { // The IBOutlet attribute only applies to instance variables of Objective-C // classes. - if (ObjCIvarDecl *ID = dyn_cast(d)) - ID->addAttr(new IBOutletAttr()); + if (isa(d) || isa(d)) + d->addAttr(new IBOutletAttr()); else - S.Diag(Attr.getLoc(), diag::err_attribute_iboutlet_non_ivar); + S.Diag(Attr.getLoc(), diag::err_attribute_iboutlet); } static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {