r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 11:22:28 PST 2016


On Tue, Feb 23, 2016 at 11:15 AM, Hans Wennborg <hans at chromium.org> wrote:
> I'm sorry, but I had to revert this in order to revert r261634. r261657

Meant to say the revert is in r261670.

>
> On Tue, Feb 23, 2016 at 9:13 AM, Adrian Prantl via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>> Author: adrian
>> Date: Tue Feb 23 11:13:47 2016
>> New Revision: 261657
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
>> Log:
>> 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.
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
>> @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
>>    // 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),
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list