[cfe-commits] [Patch] Fix crash when attempting to dump a StringLiteral with wchar's in it.

Richard Smith richard at metafoo.co.uk
Tue Jun 12 23:00:00 PDT 2012


LGTM

+      if (Char <= 0xff && isprint(Char))
+        OS << (char)Char;

I appreciate this is just copy-pasted, but I noticed that the 'Char <=
0xff' condition is always true here (and the 'else' case can't cope with
cases where Char > 0xff either). Maybe remove the 'Char <= 0xff' test?

On Tue, Jun 12, 2012 at 8:32 PM, Richard Trieu <rtrieu at google.com> wrote:

> There are several places that crash when processing wchars: the dump
> methods used for debugging, -ast-dump, and -ast-dump-xml.  This was from
> StmtDumper attempting to get a standard string from StringLiteral, which is
> only allowed when the string is composed of standard chars.  A different
> visitor, StmtPrinter, already has the logic to nicely print out strings of
> different types.  This patch moves this logic into a function in
> StringLiteral class and has both StmtDumper and StmtPrinter call this new
> function.
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120612/c9687da9/attachment.html>


More information about the cfe-commits mailing list