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 15:52:58 PST 2016


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? 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)?


> <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?


> +    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/b2431431/attachment.html>


More information about the cfe-commits mailing list