[llvm] r238287 - MCSymbol: Make print() robust against empty names
Matthias Braun
matze at braunis.de
Tue May 26 22:12:37 PDT 2015
Author: matze
Date: Wed May 27 00:12:37 2015
New Revision: 238287
URL: http://llvm.org/viewvc/llvm-project?rev=238287&view=rev
Log:
MCSymbol: Make print() robust against empty names
This shouldn't happen, but it's nice not to abort when printing broken machine
functions.
Modified:
llvm/trunk/lib/MC/MCSymbol.cpp
Modified: llvm/trunk/lib/MC/MCSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=238287&r1=238286&r2=238287&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbol.cpp Wed May 27 00:12:37 2015
@@ -50,6 +50,10 @@ void MCSymbol::print(raw_ostream &OS) co
// 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;
More information about the llvm-commits
mailing list