[PATCH] D45122: [DebugInfo] Add a new DI flag to record if a C++ record is a trivial type

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 15:05:08 PDT 2018


Does the proposed clang change (using 'isTrivial') match MSVC's behavior in
these cases?

Any idea what this information is used for by the debugger? (because it
seems /likely/ it uses it for similar things to the PassByValue/Reference
stuff - that's something important to a debugger)

On Mon, Apr 2, 2018 at 12:42 PM Aaron Smith via Phabricator <
reviews at reviews.llvm.org> wrote:

> asmith added a comment.
>
> I don't think those DWARF flags help in this case but let's check.
> Here are the results of changing the flag as suggested and rerunning
> the test from https://reviews.llvm.org/D45123. We can see that several
> places that are not
> marked as Trivial are marked as PassByValue meaning that we cannot
> rely on PassByValue to mean Trivial.
>
> $ grep ByValue function-options.ll
>
> // These are not Trivial but they are PassByValue
>
> !19 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
> "BClass", file: !9, line: 10, size: 8, flags: DIFlagTypePassByValue,
> elements: !20, identifier: ".?AVBClass@@")
> !43 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
> "C2Class", file: !9, line: 25, size: 8, flags: DIFlagTypePassByValue,
> elements: !44, identifier: ".?AVC2Class@@")
> !55 = distinct !DICompositeType(tag: DW_TAG_class_type, name:
> "DClass", file: !9, line: 32, size: 8, flags: DIFlagTypePassByValue,
> elements: !56, identifier: ".?AVDClass@@")
> !107 = distinct !DICompositeType(tag: DW_TAG_structure_type, name:
> "BStruct", file: !9, line: 63, size: 8, flags: DIFlagTypePassByValue,
> elements: !108, identifier: ".?AUBStruct@@")
>
> If you look at the corresponding change to clang in
> https://reviews.llvm.org/D45124 you will
> see that Trivial and PassByValue/Reference are a bit different.
>
>   if (auto CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
>     if (CGM.getCXXABI().getRecordArgABI(CXXRD) == CGCXXABI::RAA_Indirect)
>       Flags |= llvm::DINode::FlagTypePassByReference;
>     else
>       Flags |= llvm::DINode::FlagTypePassByValue;
>
>     // When emitting codeview, record if a C++ record is trivial type.
>     if (CGM.getCodeGenOpts().EmitCodeView) {
>       if (CXXRD->isTrivial())
>         Flags |= llvm::DINode::FlagTrivial;
>     }
>   }
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45122
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180402/23a19370/attachment.html>


More information about the llvm-commits mailing list