Prevent assertion with "llc -debug" and anonymous symbols.
authorTim Northover <tnorthover@apple.com>
Thu, 15 Oct 2015 16:18:27 +0000 (16:18 +0000)
committerTim Northover <tnorthover@apple.com>
Thu, 15 Oct 2015 16:18:27 +0000 (16:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250425 91177308-0d34-0410-b5e6-96231b3b80d8

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);