aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-07-14 02:47:58 +0000
committerDevang Patel <dpatel@apple.com>2009-07-14 02:47:58 +0000
commit61b5f3e12c0ab5dd2e8b98bb827855420bb9869b (patch)
treef8e0575a514236c69dc844c9a52a4d053c1ad25f /lib/CodeGen/CGDebugInfo.cpp
parent9df4bb32dfafd963396155df8472904dde6a6827 (diff)
Use LLVM mangler to get mangled name for debug info entry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 0344f562a7..7855b91f1f 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -19,6 +19,7 @@
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CompileOptions.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
@@ -33,12 +34,22 @@
using namespace clang;
using namespace clang::CodeGen;
-CGDebugInfo::CGDebugInfo(CodeGenModule *m)
+CGDebugInfo::CGDebugInfo(CodeGenModule *m, TargetInfo *t)
: M(m), isMainCompileUnitCreated(false), DebugFactory(M->getModule()),
BlockLiteralGenericSet(false) {
+ LLVMMangler = new llvm::Mangler(m->getModule(), t->getUserLabelPrefix(), ".");
+ // add chars used in ObjC method names so method names aren't mangled
+ LLVMMangler->markCharAcceptable('[');
+ LLVMMangler->markCharAcceptable(']');
+ LLVMMangler->markCharAcceptable('(');
+ LLVMMangler->markCharAcceptable(')');
+ LLVMMangler->markCharAcceptable('-');
+ LLVMMangler->markCharAcceptable('+');
+ LLVMMangler->markCharAcceptable(' ');
}
CGDebugInfo::~CGDebugInfo() {
+ delete LLVMMangler;
assert(RegionStack.empty() && "Region stack mismatch, stack not empty!");
}
@@ -820,8 +831,6 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
llvm::Function *Fn,
CGBuilderTy &Builder) {
- const char *LinkageName = Name;
-
// Skip the asm prefix if it exists.
//
// FIXME: This should probably be the unmangled name?
@@ -834,7 +843,8 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
unsigned LineNo = SM.getPresumedLoc(CurLoc).getLine();
llvm::DISubprogram SP =
- DebugFactory.CreateSubprogram(Unit, Name, Name, LinkageName, Unit, LineNo,
+ DebugFactory.CreateSubprogram(Unit, Name, Name, LLVMMangler->getValueName(Fn),
+ Unit, LineNo,
getOrCreateType(ReturnType, Unit),
Fn->hasInternalLinkage(), true/*definition*/);
@@ -969,7 +979,9 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
ArrayType::Normal, 0);
}
- DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
+ DebugFactory.CreateGlobalVariable(Unit, Name, Name,
+ LLVMMangler->getValueName(Var),
+ Unit, LineNo,
getOrCreateType(T, Unit),
Var->hasInternalLinkage(),
true/*definition*/, Var);
@@ -999,7 +1011,9 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
ArrayType::Normal, 0);
}
- DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
+ DebugFactory.CreateGlobalVariable(Unit, Name, Name,
+ LLVMMangler->getValueName(Var),
+ Unit, LineNo,
getOrCreateType(T, Unit),
Var->hasInternalLinkage(),
true/*definition*/, Var);