Prevent assertion with "llc -debug" and anonymous symbols.
[oota-llvm.git] / lib / MC / MCExpr.cpp
index 916e505c4b9309862de73fae1475338ce5136f26..9d01e13e0a2699121c1094c26580c8e0161a9f93 100644 (file)
@@ -43,7 +43,7 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
     const MCSymbol &Sym = SRE.getSymbol();
     // Parenthesize names that start with $ so that they don't look like
     // absolute names.
-    bool UseParens = Sym.getName()[0] == '$';
+    bool UseParens = Sym.getName().size() && Sym.getName()[0] == '$';
     if (UseParens) {
       OS << '(';
       Sym.print(OS, MAI);