r195322 - Refactor some of handleObjCBridgeAttr to make it more concise and the diagnostic reusable.
Ted Kremenek
kremenek at apple.com
Thu Nov 21 21:51:58 PST 2013
Test please, for what? All I did was make existing code more concise.
On Nov 21, 2013, at 8:33 AM, jahanian <fjahanian at apple.com> wrote:
> Test please.
> - Fariborz
>
> On Nov 20, 2013, at 11:20 PM, Ted Kremenek <kremenek at apple.com> wrote:
>
>> Author: kremenek
>> Date: Thu Nov 21 01:20:34 2013
>> New Revision: 195322
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=195322&view=rev
>> Log:
>> Refactor some of handleObjCBridgeAttr to make it more concise and the diagnostic reusable.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=195322&r1=195321&r2=195322&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 21 01:20:34 2013
>> @@ -2433,8 +2433,8 @@ def err_ns_bridged_not_interface : Error
>> "parameter of 'ns_bridged' attribute does not name an Objective-C class">;
>>
>> // objc_bridge attribute diagnostics.
>> -def err_objc_bridge_not_id : Error<
>> - "parameter of 'objc_bridge' attribute must be a single name of an Objective-C class">;
>> +def err_objc_attr_not_id : Error<
>> + "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
>> def err_objc_cf_bridged_not_interface : Error<
>> "CF object of type %0 is bridged to '%1', which is not an Objective-C class">;
>> def err_objc_ns_bridged_invalid_cfobject : Error<
>>
>> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195322&r1=195321&r2=195322&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Nov 21 01:20:34 2013
>> @@ -4347,19 +4347,18 @@ static void handleObjCBridgeAttr(Sema &S
>> : ExpectedStructOrUnion);
>> return;
>> }
>> -
>> - if (Attr.getNumArgs() != 1) {
>> - S.Diag(D->getLocStart(), diag::err_objc_bridge_not_id);
>> - return;
>> - }
>> - IdentifierLoc *Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0;
>> +
>> + IdentifierLoc *Parm = 0;
>> + if (Attr.getNumArgs() == 1)
>> + Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0;
>> +
>> if (!Parm) {
>> - S.Diag(D->getLocStart(), diag::err_objc_bridge_not_id);
>> + S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
>> return;
>> }
>>
>> D->addAttr(::new (S.Context)
>> - ObjCBridgeAttr(Attr.getRange(), S.Context, Parm ? Parm->Ident : 0,
>> + ObjCBridgeAttr(Attr.getRange(), S.Context, Parm->Ident,
>> Attr.getAttributeSpellingListIndex()));
>> }
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list