[llvm-commits] [llvm] r126963 - in /llvm/trunk: lib/MC/ test/CodeGen/ARM/ test/CodeGen/Blackfin/ test/CodeGen/CellSPU/ test/CodeGen/Mips/ test/CodeGen/PowerPC/ test/CodeGen/X86/ test/CodeGen/XCore/ test/MC/ELF/

Rafael Avila de Espindola rafael.espindola at gmail.com
Fri Mar 4 08:20:50 PST 2011


> Well, that brings up two important questions:
>
> (a) What does the XMOS assembler do with section names containing e.g.
> quotes or spaces. There is an existing test case for that.

Not sure. I considered two options

*) Add a flag SuuportsQuotes and only quote if it is true. We would 
still need to reject files that would require us to quote, so it dosn't 
look like a big win from having the extra flag.

> (b) What is considered a "safe" subset for use without quoting.

I would suggest turning the loop you wrote in a needsQuote predicate:

+  for (const char *b = name.begin(), *e = name.end(); b<  e; ++b) {
 > +    if (*b == '"') // Unquoted "
 > +      OS<<  "\\\"";
 > +    else if (*b != '\\') // Neither " or backslash
 > +      OS<<  *b;
 > +    else if (b + 1 == e) // Trailing backslash
 > +      OS<<  "\\\\";
 > +    else {
 > +      OS<<  b[0]<<  b[1]; // Quoted character
 > +      ++b;
 > +    }

So it looks like a reasonable needsQuote would be

* has an unquoted "
* has a trailing backslash
* has a quoted character

> Joerg

Cheers,
Rafael



More information about the llvm-commits mailing list