[cfe-commits] r135001 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/Sema/SemaObjCProperty.cpp test/SemaObjCXX/property-type-mismatch.mm

jahanian fjahanian at apple.com
Tue Jul 12 15:54:07 PDT 2011


On Jul 12, 2011, at 3:27 PM, Eli Friedman wrote:

> On Tue, Jul 12, 2011 at 3:05 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Tue Jul 12 17:05:16 2011
>> New Revision: 135001
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=135001&view=rev
>> Log:
>> objc++: Some level of covariance is allowed in ObjC properties.
>> Make it also available in ObjC++ propeties. // rdar://9740328
>> 
>> Added:
>>    cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm
>> Modified:
>>    cfe/trunk/include/clang/AST/ASTContext.h
>>    cfe/trunk/lib/AST/ASTContext.cpp
>>    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>> 
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=135001&r1=135000&r2=135001&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Tue Jul 12 17:05:16 2011
>> @@ -1417,6 +1417,7 @@
>>   bool typesAreCompatible(QualType T1, QualType T2,
>>                           bool CompareUnqualified = false); // C99 6.2.7p1
>> 
>> +  bool propertyTypesAreCompatible(QualType, QualType);
>>   bool typesAreBlockPointerCompatible(QualType, QualType);
>> 
>>   bool isObjCIdType(QualType T) const {
>> 
>> Modified: cfe/trunk/lib/AST/ASTContext.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=135001&r1=135000&r2=135001&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
>> +++ cfe/trunk/lib/AST/ASTContext.cpp Tue Jul 12 17:05:16 2011
>> @@ -5441,6 +5441,10 @@
>>   return !mergeTypes(LHS, RHS, false, CompareUnqualified).isNull();
>>  }
>> 
>> +bool ASTContext::propertyTypesAreCompatible(QualType LHS, QualType RHS) {
>> +  return !mergeTypes(LHS, RHS, false, false).isNull();
>> +}
> 
> Using mergeTypes in C++ is generally a bad idea... it's fundamentally
> implementing C semantics that don't make sense in C++, and it has
> assertions which are easy to trigger in C++.

It is being used in several places for c and c++. Comment at the very top of that routine suggests that caller
may come from c++ land. Properties are in the domain of objective-c. So, I doubt any c++ specific type
can trigger an assert and be usable as a property type. But, I can be convinced with an example.

- fariborz

> 
> -Eli
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110712/ab8fd703/attachment.html>


More information about the cfe-commits mailing list