OSDN Git Service

[DebugInfo] Add a new DI flag to record if a C++ record is a trivial type
authorAaron Smith <aaron.smith@microsoft.com>
Sat, 21 Jul 2018 05:42:13 +0000 (05:42 +0000)
committerAaron Smith <aaron.smith@microsoft.com>
Sat, 21 Jul 2018 05:42:13 +0000 (05:42 +0000)
commit1d13545e10c5574a40821115d10c54c16f7c47be
tree61b4bbe63d2d7bfaefa1fed220e507b04b3dac85
parent9d8e9ef4914ecd5a62fa32667787fa0a306401c7
[DebugInfo] Add a new DI flag to record if a C++ record is a trivial type

Summary:
This flag is used when emitting debug info and is needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs.

It is not easy to determine if a C++ record is trivial or not based on the current DICompositeType flags and other accessible debug information from Codeview. For example, without this flag the metadata for a non-trivial C++ record with user-defined ctor and a trivial one with a defaulted ctor are the same.

    struct S { S(); }
    struct S { S() = default; }

This change introduces a new DI flag and corresponding clang::CXXRecordDecl::isTrivial method to set the flag in the frontend.

Reviewers: rnk, zturner, llvm-commits, dblaikie, aleksandr.urakov, deadalnix

Reviewed By: rnk

Subscribers: asmith, probinson, aprantl, JDevlieghere

Differential Revision: https://reviews.llvm.org/D45122

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337641 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm-c/DebugInfo.h
include/llvm/IR/DebugInfoFlags.def