On Sun, Dec 9, 2012 at 8:59 AM, Richard Smith <[email protected]> wrote:
> On Fri, Nov 30, 2012 at 11:29 AM, Stephen Canon <[email protected]> wrote:
>> On Nov 30, 2012, at 2:01 PM, Dmitri Gribenko <[email protected]> wrote:
>>
>>> On Fri, Nov 30, 2012 at 1:50 PM, Stephen Canon <[email protected]> wrote:
>>>> • fixed indentation
>>>> • i32 and i64 will now have the correct size (instead of i32 being "long" 
>>>> even on LP64 platforms).  We can't do this for i8 or i16 without more 
>>>> invasive changes, so those will wait for another patch.
>>>> • MS literals get sign- or zero-extended as appropriate.
>>>> • MS literal path is generally cleaner.
>>>> • adopted hasInt128Type().
>>>
>>> +  if (sizeof(__uint64_t) <= sizeof(int)) {
>>> +    ASSERT_TRUE(PrintedStmtMSMatches(
>>> +    "void A() { 1i64, -1i64, 1ui64; }",
>>> +    "A", "1 , -1 , 1U"));
>>> +  } else if (sizeof(__uint64_t) <= sizeof(long)) {
>>> +    ASSERT_TRUE(PrintedStmtMSMatches(
>>> +    "void A() { 1i64, -1i64, 1ui64; }",
>>> +    "A", "1L , -1L , 1UL"));
>>> +  } else {
>>> +    ASSERT_TRUE(PrintedStmtMSMatches(
>>> +    "void A() { 1i64, -1i64, 1ui64; }",
>>> +    "A", "1LL , -1LL , 1ULL"));
>>> +  }
>>>
>>> This does not look portable.  Why can't we fold sizeof(__uint64_t) to
>>> 8?  And also, this assumes that clang will target the same platform as
>>> host...
>>
>> Suggestions on how to fix this welcome; it's unquestionably more correct 
>> than the test that was previously here (which simply assumed that long = 
>> 32b, long long = 64b).
>
> Maybe you could extend the 'compile a literal string' mechanism to
> allow you to specify a target triple?

That would look like this:

::testing::AssertionResult PrintedStmtWithArgsMatches(
                                          StringRef Code,
                                          const std::vector<std::string> &Args,
                                          StringRef ContainingFunction,
                                          StringRef ExpectedPrinted) {
  return PrintedStmtMatches(Code,
                            Args,
                            functionDecl(hasName(ContainingFunction),

has(compoundStmt(has(stmt().bind("id"))))),
                            ExpectedPrinted);
}

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to