Skip to content

Cleanup uses of replaceable metadata types (NFC) #72466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
llvm::DIFile *File, unsigned Line, unsigned SizeInBits,
llvm::DINode::DIFlags Flags, StringRef UniqueID, StringRef Name) {
// Forward declare this first because types may be recursive.
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, Name, Scope, File, Line,
llvm::dwarf::DW_LANG_Swift, SizeInBits, 0, Flags, UniqueID));

Expand Down Expand Up @@ -1232,7 +1232,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
// Default, since Swift doesn't allow specifying a custom alignment.
unsigned AlignInBits = 0;

auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_enumeration_type, MangledName, Scope, File, Line,
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
MangledName));
Expand Down Expand Up @@ -1286,7 +1286,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {

// A variant part should actually be a child to a DW_TAG_structure_type
// according to the DWARF spec.
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
MangledName));
Expand Down Expand Up @@ -1361,7 +1361,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {

// A variant part should actually be a child to a DW_TAG_structure_type
// according to the DWARF spec.
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
MangledName));
Expand Down Expand Up @@ -1561,7 +1561,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
unsigned SizeInBits, unsigned AlignInBits,
llvm::DINode::DIFlags Flags,
StringRef MangledName) {
auto FwdDecl = llvm::TempDINode(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_subroutine_type, MangledName, Scope, MainFile, 0,
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
MangledName));
Expand Down Expand Up @@ -1627,7 +1627,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
// FIXME: assert that SizeInBits == OffsetInBits.
SizeInBits = OffsetInBits;

auto FwdDecl = llvm::TempDINode(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, MainFile, 0,
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
MangledName));
Expand Down Expand Up @@ -1951,7 +1951,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
auto DerivedFrom = Superclass.isNull()
? nullptr
: getOrCreateDesugaredType(Superclass, DbgTy);
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, L.File,
FwdDeclLine, llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits,
Flags));
Expand Down Expand Up @@ -2307,7 +2307,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
// winning over a full definition.
auto *FwdDecl = DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0, 0,
llvm::dwarf::DW_LANG_Swift, 0, 0, llvm::DINode::FlagFwdDecl);
llvm::dwarf::DW_LANG_Swift);
FwdDeclTypes.emplace_back(
std::piecewise_construct, std::make_tuple(MangledName),
std::make_tuple(static_cast<llvm::Metadata *>(FwdDecl)));
Expand Down Expand Up @@ -2463,7 +2463,7 @@ void IRGenDebugInfoImpl::finalize() {
// Finalize all replaceable forward declarations.
auto finalize = [&](llvm::MDNode *FwdDeclType, llvm::MDNode *FullType,
llvm::MDString *UID = nullptr) {
llvm::TempMDNode FwdDecl(cast<llvm::MDNode>(FwdDeclType));
llvm::TempDICompositeType FwdDecl(cast<llvm::DICompositeType>(FwdDeclType));
llvm::Metadata *Replacement = FullType ? FullType : FwdDeclType;
llvm::Metadata *Replaced = DBuilder.replaceTemporary(
std::move(FwdDecl), cast<llvm::MDNode>(Replacement));
Expand Down