[cfe-commits] r122592 - /cfe/trunk/lib/Sema/SemaExpr.cpp

John McCall rjmccall at apple.com
Tue Dec 28 09:05:54 PST 2010


On Dec 28, 2010, at 8:53 AM, Abramo Bagnara wrote:

> Il 28/12/2010 17:45, John McCall ha scritto:
>> 
>> On Dec 28, 2010, at 3:13 AM, Abramo Bagnara wrote:
>> 
>>> Il 28/12/2010 11:54, Sean Hunt ha scritto:
>>>> On 10-12-28 04:13 AM, Abramo Bagnara wrote:
>>>>> Author: abramo
>>>>> Date: Tue Dec 28 03:13:41 2010
>>>>> New Revision: 122592
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=122592&view=rev
>>>>> Log:
>>>>> Canonicalize types before possible cast.
>>>> 
>>>> Why is this change necessary? Can you provide a testcase?
>>> 
>>> I guess you've missed the thread with subject "[Request for review]
>>> cast<ComplexType> is called on sugared types"
>> 
>> Please do add a test case, though.  In fact, if you can add a test case that's exhaustive over those casts, that would be great.
> 
> Unfortunately this require an awareness on PrepareScalarCast details
> that I do not have.

It's used for constructing valid conversions between scalar types.  A C file that does something like this would be sufficient:

typedef _Bool Bool;
typedef int Int;
typedef long Long;
typedef float Float;
typedef double Double;
typedef _Complex float CFloat;
typedef _Complex double CDouble;
typedef _Complex int CInt;
typedef _Complex long CLong;
typedef void *VoidPtr;
typedef char *CharPtr;

void testBool(Bool aBool) {
  (Bool) aBool;
  (Int) aBool;
  ...
  (CharPtr) aBool;
}

void testInt(Int anInt) {
  ...
}

John.



More information about the cfe-commits mailing list