r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 11:25:05 PDT 2015


On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl <aprantl at apple.com> wrote:

>
> On Sep 21, 2015, at 10:59 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: adrian
>> Date: Mon Sep 21 12:48:37 2015
>> New Revision: 248184
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev
>> Log:
>> Debug Info: When building a module, emit skeleton CUs for imported
>> modules.
>>
>
> This seems like it might add a reasonable amount more debug info - is it
> necessary? Or could the debugger use the list of modules from the
> referencing/original compilation unit as the dependency set to search?
>
>
> The advantage of having this info in the modules is that it makes
> llvm-dsymutil’s life much easier because the dependency graph is explicit.
>

Why is the graph particularly helpful to dsymutil?


> The size of a skeleton CU is 11 bytes + the length of the name + 8 bytes
> of dwo_id, (the producer string is shared with the main CU) so I’m not sure
> if the savings are worth the extra complexity.
>

Depends how many modules you have, I guess...

- Dave


>
> -- adrian
>
>
>
>>
>> Added:
>>     cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>     cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
>> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
>>
>>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>>    ExternalASTSource::ASTSourceDescriptor Info;
>> -  if (ClangModuleMap) {
>> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> +    // Record a reference to an imported clang module or precompiled
>> header.
>> +    auto *Reader = CGM.getContext().getExternalSource();
>> +    auto Idx = D->getOwningModuleID();
>> +    auto Info = Reader->getSourceDescriptor(Idx);
>> +    if (Info)
>> +      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> +  } else if (ClangModuleMap) {
>>      // We are building a clang module or a precompiled header.
>>      //
>>      // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
>> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>>      }
>>    }
>>
>> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> -    // Record a reference to an imported clang module or precompiled
>> header.
>> -    auto *Reader = CGM.getContext().getExternalSource();
>> -    auto Idx = D->getOwningModuleID();
>> -    auto Info = Reader->getSourceDescriptor(Idx);
>> -    if (Info)
>> -      return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> -  }
>>    return nullptr;
>>  }
>>
>>
>> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21
>> 12:48:37 2015
>> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>>        return !Ty->isDependentType() && !Ty->isUndeducedType();
>>      }
>>
>> +    bool VisitImportDecl(ImportDecl *D) {
>> +      auto *Import = cast<ImportDecl>(D);
>> +      if (!Import->getImportedOwningModule())
>> +        DI.EmitImportDecl(*Import);
>> +      return true;
>> +    }
>> +
>>      bool VisitTypeDecl(TypeDecl *D) {
>>        QualType QualTy = Ctx.getTypeDeclType(D);
>>        if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
>>
>> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)
>> +++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21
>> 12:48:37 2015
>> @@ -0,0 +1,15 @@
>> +// RUN: rm -rf %t
>> +// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
>> +// RUN:     -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
>> +// RUN:     %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
>> +// REQUIRES: asserts
>> +
>> + at import diamond_left;
>> +
>> +// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top
>> +// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left
>> +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
>> +// CHECK-SAME:              entity: ![[MODULE:.*]], line: 3)
>> +// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
>> +// CHECK: ![[TOP_SKEL_CU:.*]] = distinct
>> !DICompileUnit({{.*}}diamond_top{{.*}}dwoId:
>> +
>>
>>
>> _______________________________________________
>> 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/20150921/8fdd8f4b/attachment-0001.html>


More information about the cfe-commits mailing list