[cfe-commits] r133639 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CGException.cpp lib/CodeGen/CGObjCGNU.cpp lib/CodeGen/CGObjCMac.cpp lib/CodeGen/CGObjCRuntime.h lib/Sema/SemaDeclCXX.cpp test/CodeGenObjCXX/catch-id-type.mm

jahanian fjahanian at apple.com
Thu Jun 23 12:07:16 PDT 2011


On Jun 22, 2011, at 1:48 PM, John McCall wrote:

> On Jun 22, 2011, at 1:21 PM, Fariborz Jahanian wrote:
>> Added:
>>   cfe/trunk/test/CodeGenObjCXX/catch-id-type.mm
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>   cfe/trunk/lib/CodeGen/CGException.cpp
>>   cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>>   cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>>   cfe/trunk/lib/CodeGen/CGObjCRuntime.h
>>   cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=133639&r1=133638&r2=133639&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jun 22 15:21:51 2011
>> @@ -3151,9 +3151,12 @@
>>  "@catch parameter declarator cannot be qualified">;
>> def err_objc_pointer_cxx_catch_gnu : Error<
>>  "can't catch Objective C exceptions in C++ in the GNU runtime">;
>> -def err_objc_pointer_cxx_catch_fragile : Error<
>> -  "can't catch Objective C exceptions in C++ in the non-unified "
>> +def warn_objc_pointer_cxx_catch_fragile : Warning<
>> +  "catching Objective C id's exceptions in C++ in the non-unified "
>>  "exception model">;
> 
> Please put this in a warning group so that users who do it intentionally
> can suppress the warning.  I suggest -Wobjc-nonunified-exceptions.
> 
>> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=133639&r1=133638&r2=133639&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Jun 22 15:21:51 2011
>> @@ -438,7 +438,7 @@
>>                                   bool lval = false);
>>  virtual llvm::Value *GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl
>>      *Method);
>> -  virtual llvm::Constant *GetEHType(QualType T);
>> +  virtual llvm::Constant *GetEHType(QualType T, const CodeGenFunction *CGF=0);
> 
> Er.  Why is a CGF necessary here?  The only use I can see is:
> 
>> -llvm::Constant *CGObjCMac::GetEHType(QualType T) {
>> +llvm::Constant *CGObjCMac::GetEHType(QualType T, const CodeGenFunction *CGF) {
>> +  if (T->isObjCIdType() ||
>> +      T->isObjCQualifiedIdType()) {
>> +    return CGM.GetAddrOfRTTIDescriptor(
>> +              CGF->getContext().ObjCIdRedefinitionType, /*ForEH=*/true);
>> +  }
> 
> But CodeGenModule has a getContext() method, too.
> 
> Also, I think these users want to be able to throw and catch any Objective-C
> type, not just id and qualified id, and it looks like this will change the EH
> type we use for 'id' in a fragile @catch, too, which seems wrong.

This is all done in r133747. As we talked before, @catch is not impacted by this change.

- Fariborz

> 
> John.




More information about the cfe-commits mailing list