diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfException.cpp | 11 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 18 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfPrinter.h | 8 |
3 files changed, 25 insertions, 12 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index f6feccdac8..2fcee3e285 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -25,9 +25,11 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Support/Mangler.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/StringExtras.h" +#include <sstream> using namespace llvm; static TimerGroup &getDwarfTimerGroup() { @@ -599,9 +601,12 @@ void DwarfException::EmitExceptionTable() { EmitLabel("exception", SubprogramCount); if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - std::string SjLjName = "_lsda_"; - SjLjName += MF->getFunction()->getName().str(); - EmitLabel(SjLjName.c_str(), 0); + std::stringstream out; + out << Asm->getFunctionNumber(); + std::string LSDAName = + Asm->Mang->makeNameProper(std::string("LSDA_") + out.str(), + Mangler::Private); + EmitLabel(LSDAName.c_str(), 0, false); } // Emit the header. diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 20b959b914..60ff2c57cd 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -43,21 +43,27 @@ void Dwarf::PrintRelDirective(bool Force32Bit, bool isInSection) const { /// PrintLabelName - Print label name in form used by Dwarf writer. /// -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { - O << MAI->getPrivateGlobalPrefix() << Tag; +void Dwarf::PrintLabelName(const char *Tag, unsigned Number, + bool ForcePrivate) const { + if (ForcePrivate) + O << MAI->getPrivateGlobalPrefix(); + O << Tag; if (Number) O << Number; } void Dwarf::PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix) const { - O << MAI->getPrivateGlobalPrefix() << Tag; + const char *Suffix, bool ForcePrivate) const { + if (ForcePrivate) + O << MAI->getPrivateGlobalPrefix(); + O << Tag; if (Number) O << Number; O << Suffix; } /// EmitLabel - Emit location label for internal use by Dwarf. /// -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { - PrintLabelName(Tag, Number); +void Dwarf::EmitLabel(const char *Tag, unsigned Number, + bool ForcePrivate) const { + PrintLabelName(Tag, Number, ForcePrivate); O << ":\n"; } diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h index 33ebb3bd0e..01aa775ebe 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h @@ -100,16 +100,18 @@ namespace llvm { void PrintLabelName(const DWLabel &Label) const { PrintLabelName(Label.getTag(), Label.getNumber()); } - void PrintLabelName(const char *Tag, unsigned Number) const; void PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix) const; + bool ForcePrivate = true) const; + void PrintLabelName(const char *Tag, unsigned Number, + const char *Suffix, bool ForcePrivate = true) const; /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(const DWLabel &Label) const { EmitLabel(Label.getTag(), Label.getNumber()); } - void EmitLabel(const char *Tag, unsigned Number) const; + void EmitLabel(const char *Tag, unsigned Number, + bool ForcePrivate = true) const; /// EmitReference - Emit a reference to a label. /// |