parenthesize symbol names that start with $, fixing X86/dollar-name.ll with

the new asmprinter.

llvm-svn: 81269
This commit is contained in:
Chris Lattner 2009-09-08 23:20:50 +00:00
parent dae3e56cb7
commit 22833a3cd6
1 changed files with 13 additions and 2 deletions

View File

@ -20,9 +20,20 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << cast<MCConstantExpr>(*this).getValue(); OS << cast<MCConstantExpr>(*this).getValue();
return; return;
case MCExpr::SymbolRef: case MCExpr::SymbolRef: {
cast<MCSymbolRefExpr>(*this).getSymbol().print(OS, MAI); const MCSymbol &Sym = cast<MCSymbolRefExpr>(*this).getSymbol();
// Parenthesize names that start with $ so that they don't look like
// absolute names.
if (Sym.getName()[0] == '$') {
OS << '(';
Sym.print(OS, MAI);
OS << ')';
} else {
Sym.print(OS, MAI);
}
return; return;
}
case MCExpr::Unary: { case MCExpr::Unary: {
const MCUnaryExpr &UE = cast<MCUnaryExpr>(*this); const MCUnaryExpr &UE = cast<MCUnaryExpr>(*this);