[cfe-commits] r75314 - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/PathSensitive/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Frontend/ lib/Sema/ test/CodeGenObjC/ test/PCH/ test/SemaObjC/ test/SemaObjCXX/

Chris Lattner clattner at apple.com
Mon Jul 13 13:58:30 PDT 2009


On Jul 13, 2009, at 1:47 PM, steve naroff wrote:
> On Jul 13, 2009, at 4:18 PM, Chris Lattner wrote:
>>>>> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Jul 10 18:34:53  
>>>>> 2009
>>>>> @@ -987,7 +987,7 @@
>>>>> }
>>>>>
>>>>> Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) {
>>>>> -  if (!Ops.Ty->isPointerType()) {
>>>>> +  if (!Ops.Ty->isPointerType() && !Ops.Ty- 
>>>>> >isObjCObjectPointerType()) {
>>>>
>>>> Another candidate for "isAnyPointerType"?  What happens when you  
>>>> add an objc pointer to an integer?
>>>
>>> You can't have an objc pointer to an integer (that's why I called  
>>> the class ObjCObjectPointerType)....an ObjCObjectPointerType can  
>>> only refer to an interface (built-in or user-defined).
>>>
>>> Maybe I don't understand your question.
>>
>> I mean something like:
>>
>> NSString *X;
>>   X+4;
>>
>
> I see...I guess I read your response too quickly (sorry for the  
> confusion).
>
> clang allows this (for GCC compatibility). I'd have no problem  
> rejecting code like this (since it is silly):

We do reject it in 64-bit mode, but that's not my point.  This code is  
in the code generator: codegen should be handling objc and c pointers  
the same here I think.

Thanks Steve,

-Chris




More information about the cfe-commits mailing list