forked from llvm-mirror/clang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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; }; <rdar://problem/36034993> Differential Revision: https://reviews.llvm.org/D41039 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321845 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
38b23a4
commit 2e7d8ba
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s | ||
|
||
// Not trivially copyable because of the explicit destructor. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "RefDtor",{{.*}}flags: DIFlagTypePassByReference | ||
struct RefDtor { | ||
int i; | ||
~RefDtor() {} | ||
} refDtor; | ||
|
||
// Not trivially copyable because of the explicit copy constructor. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "RefCopy",{{.*}}flags: DIFlagTypePassByReference | ||
struct RefCopy { | ||
int i; | ||
RefCopy() = default; | ||
RefCopy(RefCopy &Copy) {} | ||
} refCopy; | ||
|
||
// Not trivially copyable because of the explicit move constructor. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "RefMove",{{.*}}flags: DIFlagTypePassByReference | ||
struct RefMove { | ||
int i; | ||
RefMove() = default; | ||
RefMove(RefMove &&Move) {} | ||
} refMove; | ||
|
||
// POD-like type even though it defines a destructor. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "Podlike", {{.*}}flags: DIFlagTypePassByValue | ||
struct Podlike { | ||
int i; | ||
Podlike() = default; | ||
Podlike(Podlike &&Move) = default; | ||
~Podlike() = default; | ||
} podlike; | ||
|
||
|
||
// This is a POD type. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "Pod",{{.*}}flags: DIFlagTypePassByValue | ||
struct Pod { | ||
int i; | ||
} pod; | ||
|
||
// This is definitely not a POD type. | ||
// CHECK-DAG: !DICompositeType({{.*}}, name: "Complex",{{.*}}flags: DIFlagTypePassByReference | ||
struct Complex { | ||
Complex() {} | ||
Complex(Complex &Copy) : i(Copy.i) {}; | ||
int i; | ||
} complex; |