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
This commit is contained in:
Matthias Braun 2015-05-27 05:12:37 +00:00
parent e498b5094c
commit 299e50237a

View File

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