diff options
author | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-06-20 13:08:47 +0200 |
---|---|---|
committer | Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com> | 2023-06-20 13:08:47 +0200 |
commit | 6bea8331f9e09ba94a225c65becd4224a1a473af (patch) | |
tree | daa1f4088e63d144fb22fa80eb859b2e6b79b421 /llvm/lib/IR/DIBuilder.cpp | |
parent | f6c1796b446f4c6cbff082fe3dd3f982171a8597 (diff) | |
download | llvm-6bea8331f9e09ba94a225c65becd4224a1a473af.zip llvm-6bea8331f9e09ba94a225c65becd4224a1a473af.tar.gz llvm-6bea8331f9e09ba94a225c65becd4224a1a473af.tar.bz2 |
Revert "Reland "[DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)" (2)"
This reverts commit cb9ac7051589ea0d05507f9370d0716bef86b4ae.
It causes an assert in clang:
virtual void llvm::DwarfDebug::endFunctionImpl(const llvm::MachineFunction*): Assertion `LScopes.getAbstractScopesList().size() == NumAbstractSubprograms && "getOrCreateAbstractScope() inserted an abstract subprogram scope"' failed.
https://bugs.chromium.org/p/chromium/issues/detail?id=1456288#c2
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 242ca44..ae1a1a3 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -29,7 +29,7 @@ DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU) AllowUnresolvedNodes(AllowUnresolvedNodes) { if (CUNode) { if (const auto &ETs = CUNode->getEnumTypes()) - EnumTypes.assign(ETs.begin(), ETs.end()); + AllEnumTypes.assign(ETs.begin(), ETs.end()); if (const auto &RTs = CUNode->getRetainedTypes()) AllRetainTypes.assign(RTs.begin(), RTs.end()); if (const auto &GVs = CUNode->getGlobalVariables()) @@ -66,10 +66,10 @@ void DIBuilder::finalize() { return; } - if (!EnumTypes.empty()) + if (!AllEnumTypes.empty()) CUNode->replaceEnumTypes(MDTuple::get( - VMContext, SmallVector<Metadata *, 16>(EnumTypes.begin(), - EnumTypes.end()))); + VMContext, SmallVector<Metadata *, 16>(AllEnumTypes.begin(), + AllEnumTypes.end()))); SmallVector<Metadata *, 16> RetainValues; // Declarations and definitions of the same type may be retained. Some @@ -334,13 +334,10 @@ DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name, DIScope *Context, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Annotations) { - auto *T = - DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File, LineNo, - getNonCompileUnitScope(Context), Ty, 0, AlignInBits, 0, - std::nullopt, Flags, nullptr, Annotations); - if (isa_and_nonnull<DILocalScope>(Context)) - getSubprogramNodesTrackingVector(Context).emplace_back(T); - return T; + return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File, + LineNo, getNonCompileUnitScope(Context), Ty, 0, + AlignInBits, 0, std::nullopt, Flags, nullptr, + Annotations); } DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) { @@ -488,8 +485,6 @@ DICompositeType *DIBuilder::createClassType( OffsetInBits, Flags, Elements, 0, VTableHolder, cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier); trackIfUnresolved(R); - if (isa_and_nonnull<DILocalScope>(Context)) - getSubprogramNodesTrackingVector(Context).emplace_back(R); return R; } @@ -503,8 +498,6 @@ DICompositeType *DIBuilder::createStructType( getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0, Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier); trackIfUnresolved(R); - if (isa_and_nonnull<DILocalScope>(Context)) - getSubprogramNodesTrackingVector(Context).emplace_back(R); return R; } @@ -517,8 +510,6 @@ DICompositeType *DIBuilder::createUnionType( getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags, Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier); trackIfUnresolved(R); - if (isa_and_nonnull<DILocalScope>(Scope)) - getSubprogramNodesTrackingVector(Scope).emplace_back(R); return R; } @@ -551,10 +542,7 @@ DICompositeType *DIBuilder::createEnumerationType( getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0, IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier); - if (isa_and_nonnull<DILocalScope>(Scope)) - getSubprogramNodesTrackingVector(Scope).emplace_back(CTy); - else - EnumTypes.emplace_back(CTy); + AllEnumTypes.emplace_back(CTy); trackIfUnresolved(CTy); return CTy; } @@ -652,8 +640,6 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, nullptr, nullptr, UniqueIdentifier); trackIfUnresolved(RetTy); - if (isa_and_nonnull<DILocalScope>(Scope)) - getSubprogramNodesTrackingVector(Scope).emplace_back(RetTy); return RetTy; } @@ -670,8 +656,6 @@ DICompositeType *DIBuilder::createReplaceableCompositeType( nullptr, Annotations) .release(); trackIfUnresolved(RetTy); - if (isa_and_nonnull<DILocalScope>(Scope)) - getSubprogramNodesTrackingVector(Scope).emplace_back(RetTy); return RetTy; } |