diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-02-23 17:13:47 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-02-23 17:13:47 +0000 |
commit | cc43f581b4d23af28cab702e51e50a576ad7f4c1 (patch) | |
tree | 095e712ef7b2b4e7fc5e60faf3ce903570d7a923 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 223538f76481821d5bf99bf69e73727226233167 (diff) | |
download | bcm5719-llvm-cc43f581b4d23af28cab702e51e50a576ad7f4c1.tar.gz bcm5719-llvm-cc43f581b4d23af28cab702e51e50a576ad7f4c1.zip |
Remove an unnecessary workaround introduced in r259975. (NFC)
Now that LLVM r259973 allows replacing a temporary type with another
temporary we can rely on the original implementation.
It is possible for enums to be created as part of
their own declcontext. In this case a FwdDecl will be created
twice. This doesn't cause a problem because both FwdDecls are
entered into the ReplaceMap: finalize() will replace the first
FwdDecl with the second and then replace the second with
complete type.
Thanks to echristo for pointing this out.
llvm-svn: 261657
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index fe497f6b93f..a0fff814e47 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) { // If this is just a forward declaration, construct an appropriately // marked node and just return it. if (isImportedFromModule || !ED->getDefinition()) { + // Note that it is possible for enums to be created as part of + // their own declcontext. In this case a FwdDecl will be created + // twice. This doesn't cause a problem because both FwdDecls are + // entered into the ReplaceMap: finalize() will replace the first + // FwdDecl with the second and then replace the second with + // complete type. + llvm::DIScope *EDContext = getDeclContextDescriptor(ED); llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation()); - - // It is possible for enums to be created as part of their own - // declcontext. We need to cache a placeholder to avoid the type being - // created twice before hitting the cache. llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType( llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0)); unsigned Line = getLineNumber(ED->getLocation()); StringRef EDName = ED->getName(); llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType( - llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), DefUnit, - Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName); - - // Cache the enum type so it is available when building the declcontext - // and replace the declcontect with the real thing. - TypeCache[Ty].reset(RetTy); - TmpContext->replaceAllUsesWith( - getDeclarationLexicalScope(*ED, QualType(Ty, 0))); + llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line, + 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName); ReplaceMap.emplace_back( std::piecewise_construct, std::make_tuple(Ty), |