diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-01-05 01:13:37 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-01-05 01:13:37 +0000 |
commit | a29aac7b774d1fec7033f6d0fdfaf919e97e8492 (patch) | |
tree | 5e587194de1e42c151a402551dd4539375bb90be /llvm/include | |
parent | 0429ebfabc4275a0f4cc120bb69e2ea317af3cfa (diff) | |
download | bcm5719-llvm-a29aac7b774d1fec7033f6d0fdfaf919e97e8492.tar.gz bcm5719-llvm-a29aac7b774d1fec7033f6d0fdfaf919e97e8492.zip |
Debug Info: Support DW_AT_calling_convention on composite types.
This implements the DWARF 5 feature described at
http://www.dwarfstd.org/ShowIssue.php?issue=141215.1
This allows a consumer to understand whether a composite data type is
trivially copyable and thus should be passed by value instead of by
reference. The canonical example is being able to distinguish the
following two types:
// S is not trivially copyable because of the explicit destructor.
struct S {
~S() {}
};
// T is a POD type.
struct T {
~T() = default;
};
This patch adds two new (DI)flags to LLVM metadata: TypePassByValue
and TypePassByReference.
<rdar://problem/36034922>
Differential Revision: https://reviews.llvm.org/D41743
llvm-svn: 321844
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm-c/DebugInfo.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/IR/DebugInfoFlags.def | 4 | ||||
-rw-r--r-- | llvm/include/llvm/IR/DebugInfoMetadata.h | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h index d17c690be4d..a5e5653630c 100644 --- a/llvm/include/llvm-c/DebugInfo.h +++ b/llvm/include/llvm-c/DebugInfo.h @@ -52,6 +52,8 @@ typedef enum { LLVMDIFlagBitField = 1 << 19, LLVMDIFlagNoReturn = 1 << 20, LLVMDIFlagMainSubprogram = 1 << 21, + LLVMDIFlagTypePassByValue = 1 << 22, + LLVMDIFlagTypePassByReference = 1 << 23, LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5), LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected | LLVMDIFlagPublic, diff --git a/llvm/include/llvm/IR/DebugInfoFlags.def b/llvm/include/llvm/IR/DebugInfoFlags.def index 7ea6346998f..96cc3e56285 100644 --- a/llvm/include/llvm/IR/DebugInfoFlags.def +++ b/llvm/include/llvm/IR/DebugInfoFlags.def @@ -43,6 +43,8 @@ HANDLE_DI_FLAG((1 << 18), IntroducedVirtual) HANDLE_DI_FLAG((1 << 19), BitField) HANDLE_DI_FLAG((1 << 20), NoReturn) HANDLE_DI_FLAG((1 << 21), MainSubprogram) +HANDLE_DI_FLAG((1 << 22), TypePassByValue) +HANDLE_DI_FLAG((1 << 23), TypePassByReference) // To avoid needing a dedicated value for IndirectVirtualBase, we use // the bitwise or of Virtual and FwdDecl, which does not otherwise @@ -52,7 +54,7 @@ HANDLE_DI_FLAG((1 << 2) | (1 << 5), IndirectVirtualBase) #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 << 21), Largest) +HANDLE_DI_FLAG((1 << 23), Largest) #undef DI_FLAG_LARGEST_NEEDED #endif diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index 75b0c43b651..f58f3df7b74 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -633,6 +633,10 @@ public: bool isStaticMember() const { return getFlags() & FlagStaticMember; } bool isLValueReference() const { return getFlags() & FlagLValueReference; } bool isRValueReference() const { return getFlags() & FlagRValueReference; } + bool isTypePassByValue() const { return getFlags() & FlagTypePassByValue; } + bool isTypePassByReference() const { + return getFlags() & FlagTypePassByReference; + } static bool classof(const Metadata *MD) { switch (MD->getMetadataID()) { |