summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-05-27 05:12:37 +0000
committerMatthias Braun <matze@braunis.de>2015-05-27 05:12:37 +0000
commite50dff0ee346af2b4ab8f89aed7cf180f40a1896 (patch)
treebfd3ec1fc9c21a8dbf7c683b11a937ce29f15e99 /llvm
parente87764f2470f6794e432506ebc8beb6ef78dd5fb (diff)
downloadbcm5719-llvm-e50dff0ee346af2b4ab8f89aed7cf180f40a1896.tar.gz
bcm5719-llvm-e50dff0ee346af2b4ab8f89aed7cf180f40a1896.zip
MCSymbol: Make print() robust against empty names
This shouldn't happen, but it's nice not to abort when printing broken machine functions. llvm-svn: 238287
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCSymbol.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 0009decef9b..b2034eaf517 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud