r213185 - Objective-C. Changes per A. Ballman's comment

jahanian fjahanian at apple.com
Wed Jul 16 13:37:00 PDT 2014


On Jul 16, 2014, at 1:08 PM, Aaron Ballman <aaron at aaronballman.com> wrote:

> On Wed, Jul 16, 2014 at 3:44 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Wed Jul 16 14:44:34 2014
>> New Revision: 213185
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=213185&view=rev
>> Log:
>> Objective-C. Changes per A. Ballman's comment
>> for my last patch. // rdar://17631257
>> 
>> Added:
>>    cfe/trunk/test/SemaObjC/objc-asm-attribute-neg-test.m
>> Modified:
>>    cfe/trunk/include/clang/AST/DeclObjC.h
>>    cfe/trunk/include/clang/Basic/Attr.td
>>    cfe/trunk/include/clang/Basic/AttrDocs.td
>>    cfe/trunk/lib/AST/DeclObjC.cpp
>>    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> 
>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=213185&r1=213184&r2=213185&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Jul 16 14:44:34 2014
>> @@ -955,6 +955,9 @@ public:
>>   void mergeClassExtensionProtocolList(ObjCProtocolDecl *const* List,
>>                                        unsigned Num,
>>                                        ASTContext &C);
>> +
>> +  /// Produce a name to be used for class's metadata. It comes either via
>> +  /// objc_runtime_name attribute or class name.
>>   StringRef getObjCRuntimeNameAsString() const;
>> 
>>   /// Returns the designated initializers for the interface.
>> @@ -1654,6 +1657,8 @@ public:
>>   /// \brief Starts the definition of this Objective-C protocol.
>>   void startDefinition();
>> 
>> +  /// Produce a name to be used for protocol's metadata. It comes either via
>> +  /// objc_runtime_name attribute or protocol name.
>>   StringRef getObjCRuntimeNameAsString() const;
>> 
>>   SourceRange getSourceRange() const override LLVM_READONLY {
>> @@ -2104,6 +2109,8 @@ public:
>>     return getName();
>>   }
>> 
>> +  /// Produce a name to be used for class's metadata. It comes either via
>> +  /// class's objc_runtime_name attribute or class name.
>>   StringRef getObjCRuntimeNameAsString() const;
>> 
>>   const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
>> 
>> Modified: cfe/trunk/include/clang/Basic/Attr.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=213185&r1=213184&r2=213185&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/Attr.td (original)
>> +++ cfe/trunk/include/clang/Basic/Attr.td Wed Jul 16 14:44:34 2014
>> @@ -993,8 +993,8 @@ def ObjCRuntimeName : Attr {
>>     let Spellings = [GNU<"objc_runtime_name">];
>>     let Subjects = SubjectList<[ObjCInterface, ObjCProtocol], ErrorDiag,
>>     "ExpectedObjectiveCInterfaceOrProtocol">;
>> -    let Args = [StringArgument<"MetadataName", 1>];
>> -    let Documentation = [Undocumented];
>> +    let Args = [StringArgument<"MetadataName">];
>> +    let Documentation = [ObjCRuntimeNameDocs];
>> }
>> 
>> def OptimizeNone : InheritableAttr {
>> 
>> Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=213185&r1=213184&r2=213185&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
>> +++ cfe/trunk/include/clang/Basic/AttrDocs.td Wed Jul 16 14:44:34 2014
>> @@ -426,6 +426,25 @@ implementation of an override in a subcl
>>   }];
>> }
>> 
>> +def ObjCRuntimeNameDocs : Documentation {
>> +    let Category = DocCatFunction;
>> +    let Content = [{
>> +        Annotation of Objective-C classes and protocols with this attribute allow to
>> +        use an alternative name for metadata names which normally use class or protocol
>> +        names as part of their names.
> 
> The phrasing here is a bit hard to understand. Would this capture the
> meaning sufficiently?
> 
> By default, the Objective-C interface or protocol identifier is used
> as the metadata name for that object. The `objc_runtime_name`
> attribute allows annotated interfaces or protocols to use the
> specified string argument as the object's metadata name instead of the
> default name.
> 

Sounds much better. In r213192 with minor change “in the metadata name” instead of
“as the metadata name” as the name has a fixed prefix as well.
- Fariborz


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140716/1fea0e78/attachment.html>


More information about the llvm-commits mailing list