[llvm-commits] [llvm] r106438 - /llvm/trunk/lib/Analysis/DebugInfo.cpp
Devang Patel
dpatel at apple.com
Mon Jun 21 11:36:58 PDT 2010
Author: dpatel
Date: Mon Jun 21 13:36:58 2010
New Revision: 106438
URL: http://llvm.org/viewvc/llvm-project?rev=106438&view=rev
Log:
Do not directly use function names to construct new name for named metadata.
"llvm.dbg.lv.~A" is not a valid name.
Modified:
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=106438&r1=106437&r2=106438&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Jun 21 13:36:58 2010
@@ -1056,7 +1056,14 @@
// 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);
More information about the llvm-commits
mailing list