r258251 - Module Debugging: Don't emit external type references to anonymous types.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 16:23:18 PST 2016


On Tue, Jan 19, 2016 at 4:04 PM, Adrian Prantl <aprantl at apple.com> wrote:

>
> On Jan 19, 2016, at 3:52 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> On Tue, Jan 19, 2016 at 3:42 PM, Adrian Prantl via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: adrian
>> Date: Tue Jan 19 17:42:53 2016
>> New Revision: 258251
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=258251&view=rev
>> Log:
>> Module Debugging: Don't emit external type references to anonymous types.
>> Even if they exist in the module, they can't be matched with the forward
>> declaration in the object file.
>>
>
> They can't be matched because they're matched by (non-mangled) name?
>
>
> Yes, dsymutil and lldb use the (non-mangled) name + DeclContext (which
> includes the qualified module name).
>
> I thought at least they'd be matched by mangled name (& perhaps we need to
> emit DW_AT_linkage_name on them to make that possible)?
>
>
> Emitting the DW_AT_linkage_name and matching/indexing types based on it is
> definitely  interesting for the future (bag of dwarf ...), but currently
> LLVM doesn’t do that.
>

Even before bag-of-dwarf, it seems using mangled names might be helpful,
but I don't think I have enough context/brain-swap-space to think about it
too hard right now.


>
>
>
>> <rdar://problem/24199640>
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>     cfe/trunk/test/Modules/ExtDebugInfo.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 19 17:42:53 2016
>> @@ -1536,8 +1536,9 @@ static bool shouldOmitDefinition(CodeGen
>>                                   const RecordDecl *RD,
>>                                   const LangOptions &LangOpts) {
>>    // Does the type exist in an imported clang module?
>> -  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition())
>> -      return true;
>> +  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&
>> +      RD->isExternallyVisible())
>>
>
> Not sure if this is the right check. There might be named things that are
> static (so not externally visible) in headers?
>
>
> I used isExternallyVisible() because it implies that the type won’t have a
> mangled name, (mostly thinking about the future where this would become
> more relevant), but at the moment we can relax this to
> RD->getName().isEmpty() and worry about nonexisting mangled names later.
>

Might be more accurate.

Probably good to have a test case with a static named type in a module too,
then?


>
> -- adrian
>
>
>
>> +    return true;
>>
>>    if (DebugKind > CodeGenOptions::LimitedDebugInfo)
>>      return false;
>>
>> Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)
>> +++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Tue Jan 19 17:42:53 2016
>> @@ -84,4 +84,13 @@ void foo() {
>>  // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]],
>>  // CHECK-SAME:             line: 16
>>
>> +// CHECK: !DIGlobalVariable(name: "GlobalUnion",
>> +// CHECK-SAME:              type: ![[GLOBAL_UNION:[0-9]+]]
>> +// CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
>> +// CHECK-SAME:                elements: !{{[0-9]+}})
>> +// CHECK: !DIGlobalVariable(name: "GlobalStruct",
>> +// CHECK-SAME:              type: ![[GLOBAL_STRUCT:[0-9]+]]
>> +// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag:
>> DW_TAG_structure_type,
>> +// CHECK-SAME:                elements: !{{[0-9]+}})
>> +
>>  // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0,
>> entity: !"_ZTSN8DebugCXX6StructE", line: 24)
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160119/46b2f229/attachment.html>


More information about the cfe-commits mailing list