[cfe-commits] r161780 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/CodeGen/ms-inline-asm.c
Chad Rosier
mcrosier at apple.com
Mon Aug 13 14:37:03 PDT 2012
On Aug 13, 2012, at 2:29 PM, Dmitri Gribenko wrote:
> On Mon, Aug 13, 2012 at 2:16 PM, Chad Rosier <mcrosier at apple.com> wrote:
>> Hi Dmitri,
>> Sorry about that, this is still somewhat unfamiliar territory.. Is this what you're suggesting?
>>
>> Index: lib/Sema/SemaStmt.cpp
>> ===================================================================
>> --- lib/Sema/SemaStmt.cpp (revision 161780)
>> +++ lib/Sema/SemaStmt.cpp (working copy)
>> @@ -2835,11 +2835,8 @@
>> SmallString<32> TokenBuf;
>> TokenBuf.resize(32);
>> bool StringInvalid = false;
>> - const char *ThisTokBuf = &TokenBuf[0];
>> - unsigned ThisTokLen =
>> - Lexer::getSpelling(AsmToks[j], ThisTokBuf, SemaRef.getSourceManager(),
>> - SemaRef.getLangOpts(), &StringInvalid);
>> - Asm += StringRef(ThisTokBuf, ThisTokLen);
>> + Asm += SemaRef.PP.getSpelling(AsmToks[j], TokenBuf, &StringInvalid);
>> + assert (!StringInvalid && "Expected valid string!");
>> break;
>> }
>>
>> Should I increase the size of the buffer?
>
> This method should take care of that by itself.
>
> I am not entirely sure about the assertion, though. I *think* that
> StringInvalid might get set to true if the user is doing something
> funny with the preprocessor -- like token pasting.
>
> Dmitri
Committed revision 161793. Thanks, 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 <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list