mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-27 05:32:22 +00:00
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
This commit is contained in:
parent
ceea301c1d
commit
d1bbc6b70e
@ -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);
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user