diff options
author | Devang Patel <dpatel@apple.com> | 2010-06-22 01:01:58 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-06-22 01:01:58 +0000 |
commit | d1bbc6b70e2288033fcb8c5b8273e8afb0fe9718 (patch) | |
tree | a4b3552d35a8a8ba72af497656045e197383be67 /lib | |
parent | ceea301c1d5af68dddd4729e5ababb23c02226fc (diff) |
Do not rely on Twine temporaries to survive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 0d0d27cb95..fe19ff8dbd 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -1059,14 +1059,14 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, 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); + NamedMDNode *FnLocals = + M.getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.", FName)); if (!FnLocals) - FnLocals = NamedMDNode::Create(VMContext, FnLVName, NULL, 0, &M); + FnLocals = NamedMDNode::Create(VMContext, Twine("llvm.dbg.lv.", FName), + NULL, 0, &M); FnLocals->addOperand(Node); } return DIVariable(Node); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5f55a3dfa5..41e4bfbaff 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2257,9 +2257,10 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) { } // Collect info for variables that were optimized out. - const Twine FnLVName = Twine("llvm.dbg.lv.", MF->getFunction()->getName()); - if (NamedMDNode *NMD = - MF->getFunction()->getParent()->getNamedMetadataUsingTwine(FnLVName)) { + const Function *F = MF->getFunction(); + const Module *M = F->getParent(); + if (NamedMDNode *NMD = + M->getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.", F->getName()))) { for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { DIVariable DV(cast_or_null<MDNode>(NMD->getOperand(i))); if (!DV || !Processed.insert(DV)) |