diff options
author | Matthias Braun <matze@braunis.de> | 2015-05-27 05:12:37 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2015-05-27 05:12:37 +0000 |
commit | e50dff0ee346af2b4ab8f89aed7cf180f40a1896 (patch) | |
tree | bfd3ec1fc9c21a8dbf7c683b11a937ce29f15e99 /llvm/lib/MC | |
parent | e87764f2470f6794e432506ebc8beb6ef78dd5fb (diff) | |
download | bcm5719-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/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCSymbol.cpp | 4 |
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; |