From 299e50237acddffae24bc968ef10627f9519be84 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 27 May 2015 05:12:37 +0000 Subject: [PATCH] MCSymbol: Make print() robust against empty names This shouldn't happen, but it's nice not to abort when printing broken machine functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238287 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCSymbol.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index 0009decef9b..b2034eaf517 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -50,6 +50,10 @@ void MCSymbol::print(raw_ostream &OS) const { // some targets support quoting names with funny characters. If the name // contains a funny character, then print it quoted. StringRef Name = getName(); + if (Name.empty()) { + OS << "\"\""; + return; + } if (!NameNeedsQuoting(Name)) { OS << Name; return;