r201899 - Add requirement that attribute 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions.

Aaron Ballman aaron at aaronballman.com
Fri Feb 21 15:00:15 PST 2014


On Fri, Feb 21, 2014 at 5:49 PM, Ted Kremenek <kremenek at apple.com> wrote:
> Author: kremenek
> Date: Fri Feb 21 16:49:04 2014
> New Revision: 201899
>
> URL: http://llvm.org/viewvc/llvm-project?rev=201899&view=rev
> Log:
> Add requirement that attribute 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions.
>
> Modified:
>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>     cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>     cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=201899&r1=201898&r2=201899&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Feb 21 16:49:04 2014
> @@ -2499,7 +2499,10 @@ def err_objc_bridged_related_invalid_cla
>  def err_objc_bridged_related_known_method : Error<
>   "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
>   "method for this conversion">;
> -
> +
> +def err_objc_attr_protocol_requires_definition : Error<
> +  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
> +
>  // Function Parameter Semantic Analysis.
>  def err_param_with_void_type : Error<"argument may not have 'void' type">;
>  def err_void_only_param : Error<
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=201899&r1=201898&r2=201899&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Feb 21 16:49:04 2014
> @@ -1643,8 +1643,14 @@ static void handleAttrWithMessage(Sema &
>                                        Attr.getAttributeSpellingListIndex()));
>  }
>
> -static void handleObjCSuppresProtocolAttr(Sema &S, Decl *D,
> +static void handleObjCSuppresProtocolAttr(Sema &S, ObjCProtocolDecl *D,

Can you leave this as Decl and do the cast inside of the function? May
seem a bit strange, but I'm trying to keep all of the handler function
declarations uniform so that we still have the option for doing
code-generated tricks in the future.

~Aaron



More information about the cfe-commits mailing list