summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-02-23 19:30:08 +0000
committerAdrian Prantl <aprantl@apple.com>2016-02-23 19:30:08 +0000
commit4594606c00ae149d2c85a2d53d2489ac1a564835 (patch)
tree206a1bba1c554eb960008f67149d89621e20c01b
parentb439c7a16db356c240b959db004d901eb5057d2c (diff)
downloadbcm5719-llvm-4594606c00ae149d2c85a2d53d2489ac1a564835.tar.gz
bcm5719-llvm-4594606c00ae149d2c85a2d53d2489ac1a564835.zip
Reapply r261657.
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. # Conflicts: # lib/CodeGen/CGDebugInfo.cpp llvm-svn: 261673
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 52bd805b81c..e300ed538ac 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2051,24 +2051,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(getDeclContextDescriptor(ED));
+ 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),
OpenPOWER on IntegriCloud