On Mon, Aug 13, 2012 at 2:16 PM, Chad Rosier <[email protected]> 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
--
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