llvm-project/clang/test/CodeGenObjC
Akira Hatanaka 090510608d [Sema] Diagnose default-initialization, destruction, and copying of
non-trivial C union types

This recommits r365985, which was reverted because it broke a few
projects using unions containing non-trivial ObjC pointer fields in
system headers. We now have a patch to fix the problem (see
https://reviews.llvm.org/D65256).

Original commit message:

This patch diagnoses uses of non-trivial C unions and structs/unions
containing non-trivial C unions in the following contexts, which require
default-initialization, destruction, or copying of the union objects,
instead of disallowing fields of non-trivial types in C unions, which is
what we currently do:

- function parameters.
- function returns.
- assignments.
- compound literals.
- block captures except capturing of `__block` variables by non-escaping blocks.
- local and global variable definitions.
- lvalue-to-rvalue conversions of volatile types.

See the discussion in https://reviews.llvm.org/D62988 for more background.

rdar://problem/50679094

Differential Revision: https://reviews.llvm.org/D63753

llvm-svn: 371275
2019-09-07 00:34:43 +00:00
..
Inputs [Sema] Diagnose default-initialization, destruction, and copying of 2019-09-07 00:34:43 +00:00
2007-04-03-ObjcEH.m
2007-05-02-Strong.m
2007-10-18-ProDescriptor.m
2007-10-23-GC-WriteBarrier.m
2008-08-25-incompatible-cond-expr.m
2008-10-3-EhValue.m
2008-10-23-invalid-icmp.m
2008-11-12-Metadata.m
2008-11-24-ConstCFStrings.m
2008-11-25-Blocks.m
2009-01-21-invalid-debug-info.m
2009-01-26-WriteBarrier-2.m
2009-02-05-VolatileProp.m
2009-08-05-utf16.m
2010-02-01-utf16-with-null.m
2010-02-09-DbgSelf.m
2010-02-15-Dbg-MethodStart.m
2010-02-23-DbgInheritance.m
2010-03-17-StructRef.m
2011-03-08-IVarLookup.m
NSFastEnumeration.m
aarch64-sve-types.m Add SVE opaque built-in types 2019-08-09 08:52:54 +00:00
arc-arm.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-block-copy-escape.m Avoid needlessly copying a block to the heap when a block literal 2019-02-27 18:17:16 +00:00
arc-blocks.m IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
arc-bridged-cast.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-captured-32bit-block-var-layout-2.m
arc-captured-32bit-block-var-layout.m
arc-captured-block-var-inlined-layout.m
arc-captured-block-var-layout.m
arc-compound-stmt.m
arc-cond-stmt.m
arc-exceptions.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-foreach.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-i386.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-ivar-layout.m
arc-linetable-autorelease.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-linetable.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-literals.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-loadweakretained-release.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-no-arc-exceptions.m Distinguish `__block` variables that are captured by escaping blocks 2018-10-01 21:51:28 +00:00
arc-no-runtime.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-precise-lifetime.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-property.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-related-result-type.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-ternary-op.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-unbridged-cast.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-unopt.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-unoptimized-byref-var.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-unsafeclaim.m [CodeGen][ObjC] Emit the retainRV marker as a module flag instead of 2019-04-10 06:20:23 +00:00
arc-weak-property.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-weak.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc-with-atthrow.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc.ll Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
arc.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
arm-atomic-scalar-setter-getter.m
arm64-int32-ivar.m
assign.m
atomic-aggregate-property.m
attr-availability.m
attr-callconv.m
attr-exception.m
attr-minsize.m
attr-noreturn.m
attr-objc-arc-inert.m [CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute 2019-06-14 22:06:28 +00:00
attr-objc-runtime-visible.m
attr-speculative-load-hardening.m [clang][slh] add Clang attr no_speculative_load_hardening 2019-01-18 17:20:46 +00:00
attr-strong.c
auto-property-synthesize-protocol.m
autorelease.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
availability-cf-link-guard.m
availability-check.m
availability-dso-local.m
bitfield-1.m
bitfield-access.m
bitfield-gnu.m
bitfield-ivar-metadata.m
bitfield-ivar-offsets.m
bitfield_encoding.m
block-6.m
block-byref-debuginfo.m Remove all uses of DIFlagBlockByrefStruct 2018-09-10 16:14:28 +00:00
block-byref-variable-layout.m
block-desc-str.m COMDAT-fold block descriptors. 2019-03-31 11:22:26 +00:00
block-over-align.m
block-ptr-type-crash.m
block-var-layout.m
blocks-1.m Distinguish `__block` variables that are captured by escaping blocks 2018-10-01 21:51:28 +00:00
blocks-2.m
blocks-3.m
blocks-4.m
blocks-5.m
blocks-ivar-debug.m
blocks.m
boxing.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
builtin-constant-p.m [CodeGen][ObjC] Fix assert on calling `__builtin_constant_p` with ObjC objects. 2019-02-08 23:02:13 +00:00
builtin-memfns.m
builtins.m
catch-lexical-block.m
category-class.m
category-super-class-meth.m
class-getter-dotsyntax.m
class-stubs.m Add the `objc_class_stub` attribute. 2019-05-30 04:09:01 +00:00
class-type.m
compatibility-alias.m
complex-double-abi.m
complex-property.m
compound-literal-property-access.m
constant-non-fragile-ivar-offset.m [CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible 2019-01-17 18:18:53 +00:00
constant-string-class-1.m
constant-string-class.m
constant-strings.m
continuation-class.m
convert-messages-to-runtime-calls.m [CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to 2019-06-04 16:29:58 +00:00
deadcode_strip_used_var.m
debug-info-block-helper.m
debug-info-block-line.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
debug-info-block-type.m
debug-info-blocks.m IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
debug-info-category.m [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags. 2018-11-28 21:18:07 +00:00
debug-info-class-extension.m
debug-info-class-extension2.m
debug-info-class-extension3.m
debug-info-crash-2.m
debug-info-crash.m
debug-info-default-synth-ivar.m
debug-info-fwddecl.m
debug-info-getter-name.m
debug-info-id-with-protocol.m
debug-info-impl.m
debug-info-instancetype.m
debug-info-ivars-extension.m
debug-info-ivars-indirect.m
debug-info-ivars-private.m
debug-info-ivars.m
debug-info-lifetime-crash.m
debug-info-linkagename.m
debug-info-nested-blocks.m
debug-info-nodebug.m
debug-info-property-accessors.m
debug-info-property-class-extension.m
debug-info-property.m
debug-info-property2.m
debug-info-property3.m
debug-info-property4.m
debug-info-property5.m
debug-info-pubtypes.m
debug-info-selector.m
debug-info-self.m
debug-info-static-var.m
debug-info-synthesis.m [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags. 2018-11-28 21:18:07 +00:00
debug-info-variadic-method.m
debug-property-synth.m [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags. 2018-11-28 21:18:07 +00:00
debuginfo-properties.m [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags. 2018-11-28 21:18:07 +00:00
default-property-synthesis.m
designated-initializers.m
disable-tail-call-escaping-block.m
dllstorage.m Fixed typos in tests: s/CHEKC/CHECK/ 2019-02-25 13:41:59 +00:00
dot-syntax-1.m
dot-syntax-2.m
dot-syntax.m
empty-collection-literals.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
encode-cstyle-method.m
encode-test-2.m
encode-test-3.m
encode-test-4.m
encode-test-5.m
encode-test-6.m [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs 2019-05-29 21:23:30 +00:00
encode-test.m [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs 2019-05-29 21:23:30 +00:00
exceptions-asm-attribute.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
exceptions-nonfragile.m
exceptions.m Re-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)" 2019-06-17 07:47:28 +00:00
extended-block-signature-encode.m
extern-void-class-decl.m [CodeGen] Handle extern references to OBJC_CLASS_$_* 2018-10-12 17:22:10 +00:00
externally-initialized-selectors.m Specify target triple to fix the tests I committed in r360359 that are 2019-05-09 18:32:16 +00:00
externally-retained.m NFC: Unforget a colon in a few CHECK: directives. 2019-07-12 02:16:56 +00:00
for-in.m
forward-class-impl-metadata.m
forward-decl-param.m
forward-declare-protocol-gnu.m
forward-protocol-metadata-symbols.m Specify target triple to fix the tests I committed in r360359 that are 2019-05-09 18:32:16 +00:00
fp2ret.m
fpret.m
fragile-arc.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
function-decay.m
gc-weak-attribute.m
gc.m
getter-property-mismatch.m [opaque pointer types] Fix the CallInfo passed to EmitCall in some 2019-02-05 16:05:50 +00:00
getter-property-type-mismatch.m
gnu-deterministic-selectors.m
gnu-empty-protocol-v3.m
gnu-exceptions.m
gnu-init.m Re-land r359250, [COFF] Statically link certain runtime library functions 2019-04-29 23:05:47 +00:00
gnustep2-category-protocol.m Fixed typos in tests: s/CHEKC/CHECK/ 2019-02-25 13:41:59 +00:00
gnustep2-category.m
gnustep2-class.m
gnustep2-ivar-offset.m [objc-gnustep] Fix encoding of ivar size for _Bool. 2019-02-03 15:05:52 +00:00
gnustep2-proto.m
hidden-visibility.m [CodeGen][ObjC] Remove the leading 'l' from symbols for protocol 2019-03-14 15:17:37 +00:00
hidden.m
id-isa-codegen.m
illegal-UTF8.m The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets only (as example ARM-only) with the following error: 2019-05-06 03:30:09 +00:00
image-info.m
implicit-objc_msgSend.m
implicit-property.m
instance-method-metadata.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
interface-layout-64.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
interface.m
ivar-base-as-invariant-load.m
ivar-invariant.m
ivar-layout-64-bitfields.m
ivar-layout-64.m
ivar-layout-array0-struct.m
ivar-layout-flexible-array.m
ivar-layout-no-optimize.m
ivar-layout-nonfragile-abi2.m
ivar-type-encoding.m
ivars.m
layout-bitfield-crash.m
link-errors.m
local-static-block.m Fix FileCheck prefixes in test case. 2019-06-05 21:11:06 +00:00
mangle-blocks.m
message-arrays.m
messages-2.m
messages.m
metadata-class-properties.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
metadata-symbols-32.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
metadata-symbols-64.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
metadata_symbols.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
misc-atomic-property.m
mrc-weak.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
mrr-autorelease.m
mrr-captured-block-var-inlined-layout.m
nested-rethrow.m
newproperty-nested-synthesis-1.m
next-objc-dispatch.m
no-category-class.m
no-sanitize.m
no-vararg-messaging.m
noescape.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
non-lazy-classes.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
nonlazy-msgSend.m
nontrivial-c-struct-exception.m
nontrivial-c-struct-func-name-collision.m
nontrivial-c-struct-within-struct-name.m [CodeGen] Add additional mangling for struct members of non trivial structs 2019-03-28 17:01:20 +00:00
ns-constant-strings.m
ns_consume_null_check.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
nsvalue-objc-boxable-ios-arc.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
nsvalue-objc-boxable-ios.m
nsvalue-objc-boxable-mac-arc.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
nsvalue-objc-boxable-mac.m
null-objc-empty-vtable.m
nullptr-assert.m
objc-align.m
objc-alloc-init.m [CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to 2019-06-04 16:29:58 +00:00
objc-arc-container-subscripting.m [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
objc-asm-attribute-test.m
objc-assign-ivar.m
objc-container-subscripting-1.m
objc-container-subscripting.m
objc-dictionary-literal.m
objc-fixed-enum.m
objc-gc-aggr-assign.m
objc-literal-debugger-test.m
objc-literal-tests.m
objc-non-trivial-struct-nrvo.m Store a pointer to the return value in a static alloca and let the debugger use that 2019-06-20 17:15:21 +00:00
objc-read-weak-byref.m
objc-runtime-name.m
objc2-assign-global.m
objc2-ivar-assign.m
objc2-legacy-dispatch.m
objc2-new-gc-api-strongcast.m
objc2-no-strong-cast.m
objc2-no-write-barrier.m
objc2-nonfragile-abi-impl.m
objc2-property-encode.m
objc2-protocol-enc.m
objc2-protocol-metadata.m
objc2-retain-codegen.m
objc2-strong-cast-1.m
objc2-strong-cast-block-import.m
objc2-strong-cast.m
objc2-weak-assign.m
objc2-weak-block-call.m
objc2-weak-compare.m
objc2-weak-import-attribute.m
objc2-weak-ivar-debug.m
objc2-weak-ivar.m
objc2-write-barrier-2.m
objc2-write-barrier-3.m
objc2-write-barrier-4.m
objc2-write-barrier-5.m
objc2-write-barrier.m
objc_copyStruct.m
object-incr-decr-1.m
objfw.m
optimize-ivar-offset-load.m [CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible 2019-01-17 18:18:53 +00:00
optimized-setter-ios-device.m
optimized-setter.m
os_log.m [clang][NewPM] Add -fno-experimental-new-pass-manager to tests 2019-06-21 16:03:06 +00:00
overloadable.m
parameterized_classes.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
personality.m
predefined-expr.m
private-extern-selector-reference.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
prop-metadata-gnu.m
property-aggregate.m
property-agrr-getter.m
property-array-type.m [opaque pointer types] Cleanup CGBuilder's Create*GEP. 2019-02-08 15:34:12 +00:00
property-atomic-bool.m
property-category-impl.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
property-complex.m
property-dbg.m
property-getter-dot-syntax.m
property-incr-decr-1.m
property-list-in-class.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
property-list-in-extension.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
property-ref-cast-to-void.m
property-section-attribute.m
property-setter-attr.m
property-type-mismatch.m
property.m
protocol-comdat.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
protocol-in-extended-class.m [CodeGen][ObjC] Remove the leading 'l' from symbols for protocol 2019-03-14 15:17:37 +00:00
protocol-property-synth.m
protocols-lazy.m
protocols.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
rdr-6732143-dangling-block-reference.m
related-result-type.m
reorder-synthesized-ivars.m [CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible 2019-01-17 18:18:53 +00:00
return-objc-object.mm
runtime-abi-match.m
runtime-fns.m
section-name.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
sections.m [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
sel-as-builtin-type.m
selector-ref-invariance.m
simplify-exceptions.mm
stand-alone-implementation.m
stret-1.m
stret-lifetime.m Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
stret.m
stret_lookup.m
strong-in-c-struct.m [Sema] Diagnose default-initialization, destruction, and copying of 2019-09-07 00:34:43 +00:00
super-classmethod-category.m
super-dotsyntax-property.m
super-dotsyntax-struct-property.m
super-message-fragileabi.m
synchronized.m
synthesize_ivar-cont-class.m
synthesize_ivar.m
tentative-cfconstantstring.m
terminate.m
try.m
ubsan-array-bounds.m
ubsan-bool.m
ubsan-check-debuglocs.m Ensure sanitizer check function calls have a !dbg location 2018-11-28 21:44:06 +00:00
ubsan-nonnull-and-nullability.m
ubsan-nonnull.m
ubsan-nullability.m
undefined-protocol.m
undefined-protocol2.m [CodeGen][ObjC] Remove the leading 'l' from symbols for protocol 2019-03-14 15:17:37 +00:00
unname-bf-metadata.m
unoptimized-setter.m
unqual-copy-restore.m
variadic-sends.m
weak-in-c-struct.m IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
weak-metaclass-visibility.m
x86_64-struct-return-gc.m