From: Devang Patel Date: Mon, 21 Jun 2010 18:36:58 +0000 (+0000) Subject: Do not directly use function names to construct new name for named metadata. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=10de3bb4fd9cd97b4c7162cfc620c791f9d2a0f9;p=oota-llvm.git Do not directly use function names to construct new name for named metadata. "llvm.dbg.lv.~A" is not a valid name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106438 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index c5cf3ffba57..0d0d27cb952 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/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);