aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-06-21 18:36:58 +0000
committerDevang Patel <dpatel@apple.com>2010-06-21 18:36:58 +0000
commite80de802704bd1369b273145c97182123c5a476b (patch)
treeff7f6c60030a2e3ad7ab1a0e1961fd34893dd8ab /llvm/lib/Analysis/DebugInfo.cpp
parent29a894dd6464d36e3ac1e5c7e2ca87fdd878107b (diff)
downloadllvm-e80de802704bd1369b273145c97182123c5a476b.zip
llvm-e80de802704bd1369b273145c97182123c5a476b.tar.gz
llvm-e80de802704bd1369b273145c97182123c5a476b.tar.bz2
Do not directly use function names to construct new name for named metadata.
"llvm.dbg.lv.~A" is not a valid name. llvm-svn: 106438
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index c5cf3ff..0d0d27c 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -1056,7 +1056,14 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
// to preserve variable info in such situation then stash it in a
// named mdnode.
DISubprogram Fn(getDISubprogram(Context));
- const Twine FnLVName = Twine("llvm.dbg.lv.", Fn.getName());
+ StringRef FName = "fn";
+ if (Fn.getFunction())
+ FName = Fn.getFunction()->getName();
+ const Twine FnLVName = Twine("llvm.dbg.lv.", FName);
+ char One = '\1';
+ if (FName.startswith(StringRef(&One, 1)))
+ FName = FName.substr(1);
+
NamedMDNode *FnLocals = M.getNamedMetadataUsingTwine(FnLVName);
if (!FnLocals)
FnLocals = NamedMDNode::Create(VMContext, FnLVName, NULL, 0, &M);