-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObjC] Make C++ triviality type traits available to non-trivial C
structs. r326307 and r327870 made changes that allowed using non-trivial C structs with fields qualified with __strong or __weak. This commit makes the following C++ triviality type traits available to non-trivial C structs: __has_trivial_assign __has_trivial_move_assign __has_trivial_copy __has_trivial_move_constructor __has_trivial_constructor __has_trivial_destructor rdar://problem/33599681 Differential Revision: https://reviews.llvm.org/D44913 llvm-svn: 328680
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
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
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,25 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify %s | ||
|
||
// expected-no-diagnostics | ||
|
||
struct Trivial { | ||
int x; | ||
}; | ||
|
||
struct NonTrivial { | ||
id x; | ||
}; | ||
|
||
int trivial_assign[__has_trivial_assign(struct Trivial) ? 1 : -1]; | ||
int trivial_move_assign[__has_trivial_move_assign(struct Trivial) ? 1 : -1]; | ||
int trivial_copy_constructor[__has_trivial_copy(struct Trivial) ? 1 : -1]; | ||
int trivial_move_constructor[__has_trivial_move_constructor(struct Trivial) ? 1 : -1]; | ||
int trivial_constructor[__has_trivial_constructor(struct Trivial) ? 1 : -1]; | ||
int trivial_destructor[__has_trivial_destructor(struct Trivial) ? 1 : -1]; | ||
|
||
int non_trivial_assign[__has_trivial_assign(struct NonTrivial) ? -1 : 1]; | ||
int non_trivial_move_assign[__has_trivial_move_assign(struct NonTrivial) ? -1 : 1]; | ||
int non_trivial_copy_constructor[__has_trivial_copy(struct NonTrivial) ? -1 : 1]; | ||
int non_trivial_move_constructor[__has_trivial_move_constructor(struct NonTrivial) ? -1 : 1]; | ||
int non_trivial_constructor[__has_trivial_constructor(struct NonTrivial) ? -1 : 1]; | ||
int non_trivial_destructor[__has_trivial_destructor(struct NonTrivial) ? -1 : 1]; |