llvm-project/clang/lib/Parse
Jordan Rose 303e2f1eac Accept nullability qualifiers on array parameters.
Since array parameters decay to pointers, '_Nullable' and friends
should be available for use there as well. This is especially
important for parameters that are typedefs of arrays. The unsugared
syntax for this follows the syntax for 'static'-sized arrays in C:

  void test(int values[_Nullable]);

This syntax was previously accepted but the '_Nullable' (and any other
attributes) were silently discarded. However, applying '_Nullable' to
a typedef was previously rejected and is now accepted; therefore, it
may be necessary to test for the presence of this feature:

  #if __has_feature(nullability_on_arrays)

One important change here is that DecayedTypes don't always
immediately contain PointerTypes anymore; they may contain an
AttributedType instead. This only affected one place in-tree, so I
would guess it's not likely to cause problems elsewhere.

This commit does not change -Wnullability-completeness just yet. I
want to think about whether it's worth doing something special to
avoid breaking existing clients that compile with -Werror. It also
doesn't change '#pragma clang assume_nonnull' behavior, which
currently treats the following two declarations as equivalent:

  #pragma clang assume_nonnull begin
  void test(void *pointers[]);
  #pragma clang assume_nonnull end

  void test(void * _Nonnull pointers[]);

This is not the desired behavior, but changing it would break
backwards-compatibility. Most likely the best answer is going to be
adding a new warning.

Part of rdar://problem/25846421

llvm-svn: 286519
2016-11-10 23:28:17 +00:00
..
CMakeLists.txt [CMake] Reorder libdeps by alphabetical order. 2014-07-14 04:59:27 +00:00
ParseAST.cpp C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
ParseCXXInlineMethods.cpp Fix heuristics skipping invalid ctor-initializers with C++11 2016-11-03 07:36:17 +00:00
ParseDecl.cpp Accept nullability qualifiers on array parameters. 2016-11-10 23:28:17 +00:00
ParseDeclCXX.cpp Fix Clang-tidy readability-redundant-string-cstr warnings 2016-11-02 10:39:27 +00:00
ParseExpr.cpp [CodeCompletion] Add a block property setter completion result 2016-10-18 10:55:01 +00:00
ParseExprCXX.cpp Add missing warning for use of C++1z init-statements in C++14 and before. 2016-10-18 20:27:16 +00:00
ParseInit.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
ParseObjc.cpp [index] Fix issue with protocol name locations in conformance list of an ObjC class when they come from a typedef. 2016-11-09 02:47:07 +00:00
ParseOpenMP.cpp Re-apply patch r279045. 2016-10-25 12:50:55 +00:00
ParsePragma.cpp [CUDA] Add #pragma clang force_cuda_host_device_{begin,end} pragmas. 2016-10-08 22:15:58 +00:00
ParseStmt.cpp [CodeCompletion] Add a block property setter completion result 2016-10-18 10:55:01 +00:00
ParseStmtAsm.cpp Fix a funny Dvorak typo. 2016-05-19 00:16:09 +00:00
ParseTemplate.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
ParseTentative.cpp regcall: Implement regcall Calling Conv in clang 2016-11-02 18:29:35 +00:00
Parser.cpp [SemaObjC] Be more strict while parsing type arguments and protocols 2016-09-13 20:04:35 +00:00
RAIIObjectsForParser.h Add a new error for unexpected semi-colon before closing delimiter. 2015-05-12 21:36:35 +00:00