llvm-project/clang/test
Volodymyr Sapsai 30680e9437 [Sema] Add support for flexible array members in Obj-C.
Allow Obj-C ivars with incomplete array type but only as the last ivar.
Also add a requirement for ivars that contain a flexible array member to
be at the end of class too. It is possible to add in a subclass another
ivar at the end but we'll emit a warning in this case. Also we'll emit a
warning if a variable sized ivar is declared in class extension or in
implementation because subclasses won't know they should avoid adding
new ivars.

In ARC incomplete array objects are treated as __unsafe_unretained so
require them to be marked as such.

Prohibit synthesizing ivars with flexible array members because order of
synthesized ivars is not obvious and tricky to control. Spelling out
ivar explicitly gives control to developers and helps to avoid surprises
with unexpected ivar ordering.

For C and C++ changed diagnostic to tell explicitly a field is not the
last one and point to the next field. It is not as useful as in Obj-C
but it is an improvement and it is consistent with Obj-C. For C for
unions emit more specific err_flexible_array_union instead of generic
err_field_incomplete.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 316381
2017-10-23 22:01:41 +00:00
..
ARCMT clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1). 2017-04-28 05:02:52 +00:00
ASTMerge
Analysis [Analyzer] Correctly handle parameters passed by reference when bodyfarming std::call_once 2017-10-20 23:29:59 +00:00
CXX [C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides in line with WG21's p0620r0. 2017-10-22 14:45:08 +00:00
CodeCompletion Fixed a crash in code completion. 2017-09-08 13:36:38 +00:00
CodeGen [CodeGen] add tests for __builtin_sqrt*; NFC 2017-10-20 23:32:41 +00:00
CodeGenCUDA CodeGenModule: Always output wchar_size, check LLVM assumptions. 2017-05-20 01:29:55 +00:00
CodeGenCXX For better compatibility with C++11 and C++14, emit a nondiscardable definition 2017-10-23 03:58:34 +00:00
CodeGenCoroutines [coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer) 2017-08-25 04:46:54 +00:00
CodeGenObjC [Sema][ObjC] Preserve syntactic sugar when removing 2017-10-10 01:24:33 +00:00
CodeGenObjCXX Fix off-by-one error in block mangling. 2017-09-07 05:41:24 +00:00
CodeGenOpenCL CodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable 2017-10-23 17:49:26 +00:00
Coverage [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output 2017-08-03 18:12:22 +00:00
CoverageMapping [Coverage] Discard deferred region in closing if-else 2017-10-17 07:47:39 +00:00
Driver [Driver] Use ld.lld directly for Fuchsia rather than passing flavor 2017-10-23 21:31:05 +00:00
FixIt Add a "vexing parse" warning for ambiguity between a variable declaration and a 2017-09-29 23:57:25 +00:00
Format [clang] Get rid of "%T" expansions 2017-08-15 19:47:06 +00:00
Frontend Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData. 2017-09-22 00:11:15 +00:00
Headers Driver: hoist the `wchar_t` handling to the driver 2017-10-06 23:09:55 +00:00
Import Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
Index [libclang] Visit attributes for function and class templates 2017-10-16 23:43:02 +00:00
Integration Fix the test fix from r312181 2017-08-30 23:26:38 +00:00
Layout
Lexer Driver: hoist the `wchar_t` handling to the driver 2017-10-06 23:09:55 +00:00
Misc Add -f[no-]double-square-bracket-attributes as new driver options to control use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later. 2017-10-15 15:01:42 +00:00
Modules [modules] When finding the owning module of an instantiated context in template 2017-10-18 01:41:38 +00:00
OpenMP [OpenMP] Avoid VLAs for some reductions on array sections 2017-10-23 19:01:35 +00:00
PCH Implement C++ [basic.link]p8. 2017-09-20 07:22:00 +00:00
Parser Make __builtin_types_compatible_p more like GCC's 2017-10-16 22:58:37 +00:00
Preprocessor Basic: restore {,u}intptr_t on NetBSD/ARM 2017-10-20 04:11:28 +00:00
Profile [Profile] Do not assign counters to functions without bodies 2017-06-30 21:02:14 +00:00
Refactor [clang-refactor] Add "-Inplace" option to the commandline tool. 2017-10-20 12:37:16 +00:00
Rewriter [clang] Remove unit test which uses reverse-iterate flag 2017-08-24 22:40:32 +00:00
Sema [Sema] Add support for flexible array members in Obj-C. 2017-10-23 22:01:41 +00:00
SemaCUDA [CUDA] When compilation fails, print the compilation mode. 2017-09-07 18:37:16 +00:00
SemaCXX [Sema] Add support for flexible array members in Obj-C. 2017-10-23 22:01:41 +00:00
SemaObjC [Sema] Add support for flexible array members in Obj-C. 2017-10-23 22:01:41 +00:00
SemaObjCXX [Sema] Add support for flexible array members in Obj-C. 2017-10-23 22:01:41 +00:00
SemaOpenCL [OpenCL] Restrict swizzle length check to OpenCL mode 2017-10-17 17:54:57 +00:00
SemaTemplate Implement current CWG direction for support of arrays of unknown bounds in 2017-10-20 22:56:25 +00:00
TableGen
Tooling [clang-diff] Treat CXXCtorInitializer as a node 2017-08-27 22:52:20 +00:00
Unit [lit] Rename lld and clang lit configs to end in .py 2017-09-21 17:38:13 +00:00
VFS
clang-rename [refactor] add clang-refactor tool with initial testing support and 2017-09-14 10:06:52 +00:00
.clang-format
CMakeLists.txt [test] Enable clang-func-mapping as a test dep with the analyzer 2017-09-22 22:17:10 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Resubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm." 2017-10-17 23:43:36 +00:00
lit.site.cfg.py.in [lit] Add host_cxx to lit config 2017-10-10 17:53:45 +00:00
make_test_dirs.pl