llvm-project/clang/test/CodeGenObjCXX
Richard Smith 5030928d60 [c++20] Implement semantic restrictions for C++20 designated
initializers.

This has some interesting interactions with our existing extensions to
support C99 designated initializers as an extension in C++. Those are
resolved as follows:

 * We continue to permit the full breadth of C99 designated initializers
   in C++, with the exception that we disallow a partial overwrite of an
   initializer with a non-trivially-destructible type. (Full overwrite
   is OK, because we won't run the first initializer at all.)

 * The C99 extensions are disallowed in SFINAE contexts and during
   overload resolution, where they could change the meaning of valid
   programs.

 * C++20 disallows reordering of initializers. We only check for that for
   the simple cases that the C++20 rules permit (designators of the form
   '.field_name =' and continue to allow reordering in other cases).
   It would be nice to improve this behavior in future.

 * All C99 designated initializer extensions produce a warning by
   default in C++20 mode. People are going to learn the C++ rules based
   on what Clang diagnoses, so it's important we diagnose these properly
   by default.

 * In C++ <= 17, we apply the C++20 rules rather than the C99 rules, and
   so still diagnose C99 extensions as described above. We continue to
   accept designated C++20-compatible initializers in C++ <= 17 silently
   by default (but naturally still reject under -pedantic-errors).

This is not a complete implementation of P0329R4. In particular, that
paper introduces new non-C99-compatible syntax { .field { init } }, and
we do not support that yet.

This is based on a previous patch by Don Hinton, though I've made
substantial changes when addressing the above interactions.

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

llvm-svn: 370544
2019-08-30 22:52:55 +00:00
..
Inputs
2007-10-03-MetadataPointers.mm
2010-08-04-Template.mm
2010-08-06-X.Y-syntax.mm
address-safety-attr.mm
arc-attrs-abi.mm
arc-attrs.mm 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-blocks.mm Avoid needlessly copying a block to the heap when a block literal 2019-02-27 18:17:16 +00:00
arc-constexpr.mm 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-cxx11-init-list.mm 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-cxx11-member-init.mm
arc-exceptions.mm 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-forwarded-lambda-call.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
arc-globals.mm 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-indirect.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
arc-list-init-destruct.mm [Sema] Check that the destructor for each element of class type is 2018-09-07 02:38:01 +00:00
arc-mangle.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
arc-marker-funclet.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
arc-move.mm 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-new-delete.mm 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-pseudo-destructors.mm 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-references.mm 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-returns-inner-reference-ptr.mm 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-special-member-functions.mm 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.mm 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.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
auto-release-result-assert.mm
block-default-arg.mm
block-id.mm
block-in-template-inst.mm
block-nested-in-lambda.mm [CodeGen] Replace '@' characters in block descriptors' symbol names with 2018-12-29 17:28:30 +00:00
block-var-layout.mm
blocks.mm
boxing.mm
catch-id-type.mm
copy.mm
copyable-property-object.mm
crash-function-type.mm Pass the function type instead of the return type to FunctionDecl::Create 2018-11-11 00:56:15 +00:00
debug-info-block-capture-this.mm
debug-info-cyclic.mm
debug-info-line.mm [DEBUGINFO] Add support for emission of the debug directives only. 2018-08-31 13:56:14 +00:00
debug-info.mm
designated-initializers.mm [c++20] Implement semantic restrictions for C++20 designated 2019-08-30 22:52:55 +00:00
destroy.mm 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.mm [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs 2019-05-29 21:23:30 +00:00
exception-cxx.mm
exceptions-legacy.mm
exceptions.mm
externally-initialized-selectors.mm Specify target triple to fix the tests I committed in r360359 that are 2019-05-09 18:32:16 +00:00
foreach-statement.mm
gc.mm
implementation-in-extern-c.mm
implicit-copy-assign-operator.mm
implicit-copy-constructor.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
inheriting-constructor-cleanup.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
instantiate-return.mm [Sema][ObjC] Ensure that the return type of an ObjC method is a complete 2018-04-12 06:01:41 +00:00
ivar-objects.mm
lambda-expressions.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
lambda-to-block.mm [CodeGen] Use the mangle context owned by CodeGenModule to correctly 2018-10-20 05:45:01 +00:00
literals.mm [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue 2019-03-21 19:59:49 +00:00
lvalue-reference-getter.mm
mangle-blocks.mm Fix off-by-one error in block mangling. 2017-09-07 05:41:24 +00:00
mangle.mm
message-reference.mm
message.mm
method-local-extern-mangle.mm
microsoft-abi-arc-param-order.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
mrc-weak.mm [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and make 2019-05-09 17:43:52 +00:00
msabi-objc-extensions.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
msabi-objc-types.mm [AST] Revert mangling changes from r339428 2018-10-04 19:50:14 +00:00
msabi-stret.mm [Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer' 2019-07-20 22:50:50 +00:00
nested-ehlocation.mm
nrvo.mm [Clang] Disable new PM for tests that use optimization level -O1, -O2 and -O3 2019-06-05 03:17:11 +00:00
objc-container-subscripting-1.mm
objc-container-subscripting.mm
objc-struct-cxx-abi.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
objc-weak.mm Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics 2018-12-18 20:33:00 +00:00
objfw-exceptions.mm
os_log.mm [clang][NewPM] Add -fno-experimental-new-pass-manager to tests 2019-06-21 16:03:06 +00:00
personality-abuse.mm
personality.mm [CodeGen] Always use MSVC personality for windows-msvc targets 2018-06-08 00:41:01 +00:00
pr14474-gline-tables-only.mm [DEBUGINFO] Add support for emission of the debug directives only. 2018-08-31 13:56:14 +00:00
property-derived-to-base-conv.mm
property-dot-copy-elision.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
property-dot-copy.mm
property-dot-reference.mm
property-lvalue-capture.mm
property-lvalue-lambda.mm [CodeGen] Fix a regression by emitting lambda expressions in EmitLValue 2019-04-02 19:48:07 +00:00
property-object-conditional-exp.mm
property-object-reference-1.mm
property-object-reference-2.mm IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
property-object-reference.mm
property-objects.mm Revert "[CodeGenCXX] Treat 'this' as noalias in constructors" 2018-10-15 15:43:00 +00:00
property-reference.mm
refence-assign-write-barrier.mm
references.mm
return.mm
rtti.mm
selector-expr-lvalue.mm
subst-sel.mm
unknown-anytype.mm
write-barrier-global-assign.mm