[llvm] r250425 - Prevent assertion with "llc -debug" and anonymous symbols.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 09:18:27 PDT 2015


Author: tnorthover
Date: Thu Oct 15 11:18:27 2015
New Revision: 250425

URL: http://llvm.org/viewvc/llvm-project?rev=250425&view=rev
Log:
Prevent assertion with "llc -debug" and anonymous symbols.

Modified:
    llvm/trunk/lib/MC/MCExpr.cpp

Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=250425&r1=250424&r2=250425&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Thu Oct 15 11:18:27 2015
@@ -43,7 +43,7 @@ void MCExpr::print(raw_ostream &OS, cons
     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);




More information about the llvm-commits mailing list