[llvm] r337641 - [DebugInfo] Add a new DI flag to record if a C++ record is a trivial type

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 22:42:14 PDT 2018


Author: asmith
Date: Fri Jul 20 22:42:13 2018
New Revision: 337641

URL: http://llvm.org/viewvc/llvm-project?rev=337641&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm-c/DebugInfo.h
    llvm/trunk/include/llvm/IR/DebugInfoFlags.def

Modified: llvm/trunk/include/llvm-c/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/DebugInfo.h?rev=337641&r1=337640&r2=337641&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/DebugInfo.h (original)
+++ llvm/trunk/include/llvm-c/DebugInfo.h Fri Jul 20 22:42:13 2018
@@ -54,6 +54,9 @@ typedef enum {
   LLVMDIFlagMainSubprogram = 1 << 21,
   LLVMDIFlagTypePassByValue = 1 << 22,
   LLVMDIFlagTypePassByReference = 1 << 23,
+  LLVMDIFlagFixedEnum = 1 << 24,
+  LLVMDIFlagThunk = 1 << 25,
+  LLVMDIFlagTrivial = 1 << 26,
   LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
   LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
                             LLVMDIFlagPublic,

Modified: llvm/trunk/include/llvm/IR/DebugInfoFlags.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoFlags.def?rev=337641&r1=337640&r2=337641&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoFlags.def (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoFlags.def Fri Jul 20 22:42:13 2018
@@ -47,6 +47,7 @@ HANDLE_DI_FLAG((1 << 22), TypePassByValu
 HANDLE_DI_FLAG((1 << 23), TypePassByReference)
 HANDLE_DI_FLAG((1 << 24), FixedEnum)
 HANDLE_DI_FLAG((1 << 25), Thunk)
+HANDLE_DI_FLAG((1 << 26), Trivial)
 
 // To avoid needing a dedicated value for IndirectVirtualBase, we use
 // the bitwise or of Virtual and FwdDecl, which does not otherwise
@@ -56,7 +57,7 @@ HANDLE_DI_FLAG((1 << 2) | (1 << 5), Indi
 #ifdef DI_FLAG_LARGEST_NEEDED
 // intended to be used with ADT/BitmaskEnum.h
 // NOTE: always must be equal to largest flag, check this when adding new flag
-HANDLE_DI_FLAG((1 << 25), Largest)
+HANDLE_DI_FLAG((1 << 26), Largest)
 #undef DI_FLAG_LARGEST_NEEDED
 #endif
 




More information about the llvm-commits mailing list