Use AsmPrinter's Mangler to remove leading '1' from linkage names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75515 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-07-13 21:48:26 +00:00
parent 65445c5b14
commit 87370b8301
2 changed files with 14 additions and 5 deletions

View File

@@ -242,7 +242,7 @@ namespace llvm {
/// special global used by LLVM. If so, emit it and return true, otherwise /// special global used by LLVM. If so, emit it and return true, otherwise
/// do nothing and return false. /// do nothing and return false.
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV); bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
public: public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
/// LEB 128 number encoding. /// LEB 128 number encoding.
@@ -333,6 +333,10 @@ namespace llvm {
/// debug tables. /// debug tables.
void printDeclare(const MachineInstr *MI) const; void printDeclare(const MachineInstr *MI) const;
/// getMangler - Return Mangler used by the AsmPrinter. This is used by
/// DWARF debug info generator.
Mangler *getMangler() { return Mang; }
/// postInstructionAction - Handling printing of items after the /// postInstructionAction - Handling printing of items after the
/// instruction iteself has been printed (e.g. comments) /// instruction iteself has been printed (e.g. comments)
void postInstructionAction(const MachineInstr &MI) const { void postInstructionAction(const MachineInstr &MI) const {

View File

@@ -15,6 +15,7 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/Support/Timer.h" #include "llvm/Support/Timer.h"
#include "llvm/Support/Mangler.h"
#include "llvm/System/Path.h" #include "llvm/System/Path.h"
#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetRegisterInfo.h"
@@ -785,9 +786,11 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name); AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
std::string LinkageName; std::string LinkageName;
GV.getLinkageName(LinkageName); GV.getLinkageName(LinkageName);
if (!LinkageName.empty()) if (!LinkageName.empty()) {
Mangler *Mg = Asm->getMangler();
AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string, AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName); Mg ? Mg->makeNameProper(LinkageName) : LinkageName);
}
AddType(DW_Unit, GVDie, GV.getType()); AddType(DW_Unit, GVDie, GV.getType());
if (!GV.isLocalToUnit()) if (!GV.isLocalToUnit())
AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1); AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
@@ -856,9 +859,11 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit,
std::string LinkageName; std::string LinkageName;
SP.getLinkageName(LinkageName); SP.getLinkageName(LinkageName);
if (!LinkageName.empty()) if (!LinkageName.empty()) {
Mangler *Mg = Asm->getMangler();
AddString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string, AddString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName); Mg ? Mg->makeNameProper(LinkageName) : LinkageName);
}
AddSourceLine(SPDie, &SP); AddSourceLine(SPDie, &SP);