diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-06-29 00:49:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-06-29 00:49:17 +0000 |
commit | 6bd56ca836e7e8866306d6ba7bb3c3575c01cf69 (patch) | |
tree | f77a15f387fd7bee961ceeb125cbd7ee9867ad83 /clang/test | |
parent | 0cb6c4bdccf2791c77f1f10e9dee613cab53343b (diff) | |
download | bcm5719-llvm-6bd56ca836e7e8866306d6ba7bb3c3575c01cf69.tar.gz bcm5719-llvm-6bd56ca836e7e8866306d6ba7bb3c3575c01cf69.zip |
Teach the __is_trivially_assignable and __is_trivially_constructible
type traits that assignment to/construction of a lifetime-qualified
object under ARC is *not* trivial. Fixes <rdar://problem/11738725>.
llvm-svn: 159401
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaObjCXX/arc-type-traits.mm | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/clang/test/SemaObjCXX/arc-type-traits.mm b/clang/test/SemaObjCXX/arc-type-traits.mm index 9877870f944..817724caf2d 100644 --- a/clang/test/SemaObjCXX/arc-type-traits.mm +++ b/clang/test/SemaObjCXX/arc-type-traits.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -std=c++11 %s // Check the results of the various type-trait query functions on // lifetime-qualified types in ARC. @@ -9,6 +9,8 @@ #define TRAIT_IS_TRUE(Trait, Type) char JOIN2(Trait,__LINE__)[Trait(Type)? 1 : -1] #define TRAIT_IS_FALSE(Trait, Type) char JOIN2(Trait,__LINE__)[Trait(Type)? -1 : 1] +#define TRAIT_IS_TRUE_2(Trait, Type1, Type2) char JOIN2(Trait,__LINE__)[Trait(Type1, Type2)? 1 : -1] +#define TRAIT_IS_FALSE_2(Trait, Type1, Type2) char JOIN2(Trait,__LINE__)[Trait(Type1, Type2)? -1 : 1] // __has_nothrow_assign TRAIT_IS_TRUE(__has_nothrow_assign, __strong id); @@ -88,3 +90,80 @@ TRAIT_IS_TRUE(__is_standard_layout, __weak id); TRAIT_IS_TRUE(__is_standard_layout, __autoreleasing id); TRAIT_IS_TRUE(__is_standard_layout, __unsafe_unretained id); +// __is_trivally_assignable +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __strong id&, __unsafe_unretained id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __weak id&, __unsafe_unretained id&&); + +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_assignable, __autoreleasing id&, __unsafe_unretained id&&); + +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __strong id); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __weak id); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __autoreleasing id); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __unsafe_unretained id); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __strong id&&); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __weak id&&); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __autoreleasing id&&); +TRAIT_IS_TRUE_2(__is_trivially_assignable, __unsafe_unretained id&, __unsafe_unretained id&&); + +// __is_trivally_constructible +TRAIT_IS_FALSE(__is_trivially_constructible, __strong id); +TRAIT_IS_FALSE(__is_trivially_constructible, __weak id); +TRAIT_IS_FALSE(__is_trivially_constructible, __autoreleasing id); +TRAIT_IS_TRUE(__is_trivially_constructible, __unsafe_unretained id); + +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __strong id, __unsafe_unretained id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __weak id, __unsafe_unretained id&&); + +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __strong id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __weak id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __autoreleasing id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __unsafe_unretained id); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __strong id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __weak id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __autoreleasing id&&); +TRAIT_IS_FALSE_2(__is_trivially_constructible, __autoreleasing id, __unsafe_unretained id&&); + +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __strong id); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __weak id); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __autoreleasing id); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __unsafe_unretained id); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __strong id&&); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __weak id&&); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __autoreleasing id&&); +TRAIT_IS_TRUE_2(__is_trivially_constructible, __unsafe_unretained id, __unsafe_unretained id&&); + |