mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
IR: Return unique_ptr from MDNode::getTemporary()
Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and clean up call sites. (For now, `DIBuilder` call sites just call `release()` immediately.) There's an accompanying change in each of clang and polly to use the new API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -142,15 +142,15 @@ DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
|
||||
assert(!Filename.empty() &&
|
||||
"Unable to create compile unit without filename");
|
||||
Metadata *TElts[] = {HeaderBuilder::get(DW_TAG_base_type).get(VMContext)};
|
||||
TempEnumTypes = MDNode::getTemporary(VMContext, TElts);
|
||||
TempEnumTypes = MDNode::getTemporary(VMContext, TElts).release();
|
||||
|
||||
TempRetainTypes = MDNode::getTemporary(VMContext, TElts);
|
||||
TempRetainTypes = MDNode::getTemporary(VMContext, TElts).release();
|
||||
|
||||
TempSubprograms = MDNode::getTemporary(VMContext, TElts);
|
||||
TempSubprograms = MDNode::getTemporary(VMContext, TElts).release();
|
||||
|
||||
TempGVs = MDNode::getTemporary(VMContext, TElts);
|
||||
TempGVs = MDNode::getTemporary(VMContext, TElts).release();
|
||||
|
||||
TempImportedModules = MDNode::getTemporary(VMContext, TElts);
|
||||
TempImportedModules = MDNode::getTemporary(VMContext, TElts).release();
|
||||
|
||||
Metadata *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_compile_unit)
|
||||
.concat(Lang)
|
||||
@ -825,7 +825,7 @@ DICompositeType DIBuilder::createReplaceableForwardDecl(
|
||||
nullptr, // TemplateParams
|
||||
UniqueIdentifier.empty() ? nullptr
|
||||
: MDString::get(VMContext, UniqueIdentifier)};
|
||||
DICompositeType RetTy(MDNode::getTemporary(VMContext, Elts));
|
||||
DICompositeType RetTy(MDNode::getTemporary(VMContext, Elts).release());
|
||||
assert(RetTy.isCompositeType() &&
|
||||
"createReplaceableForwardDecl result should be a DIType");
|
||||
if (!UniqueIdentifier.empty())
|
||||
@ -903,7 +903,7 @@ DIGlobalVariable DIBuilder::createTempGlobalVariableFwdDecl(
|
||||
return createGlobalVariableHelper(VMContext, Context, Name, LinkageName, F,
|
||||
LineNumber, Ty, isLocalToUnit, Val, Decl,
|
||||
false, [&](ArrayRef<Metadata *> Elts) {
|
||||
return MDNode::getTemporary(VMContext, Elts);
|
||||
return MDNode::getTemporary(VMContext, Elts).release();
|
||||
});
|
||||
}
|
||||
|
||||
@ -1007,7 +1007,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
|
||||
return createFunctionHelper(VMContext, Context, Name, LinkageName, File,
|
||||
LineNo, Ty, isLocalToUnit, isDefinition,
|
||||
ScopeLine, Flags, isOptimized, Fn, TParams, Decl,
|
||||
MDNode::getTemporary(VMContext, None),
|
||||
MDNode::getTemporary(VMContext, None).release(),
|
||||
[&](ArrayRef<Metadata *> Elts) -> MDNode *{
|
||||
MDNode *Node = MDNode::get(VMContext, Elts);
|
||||
// Create a named metadata so that we
|
||||
@ -1030,7 +1030,7 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name,
|
||||
LineNo, Ty, isLocalToUnit, isDefinition,
|
||||
ScopeLine, Flags, isOptimized, Fn, TParams, Decl,
|
||||
nullptr, [&](ArrayRef<Metadata *> Elts) {
|
||||
return MDNode::getTemporary(VMContext, Elts);
|
||||
return MDNode::getTemporary(VMContext, Elts).release();
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user