llvm-project/clang/lib/Lex
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] Use LINK_LIBS instead of target_link_libraries(). 2014-02-26 06:41:29 +00:00
HeaderMap.cpp Use StringRef for MemoryBuffer identifier API (NFC) 2016-10-01 16:38:28 +00:00
HeaderSearch.cpp Add some more asserts to clearly indicate that there are special cases 2016-11-04 06:32:57 +00:00
Lexer.cpp Move UTF functions into namespace llvm. 2016-09-30 00:38:45 +00:00
LiteralSupport.cpp Move UTF functions into namespace llvm. 2016-09-30 00:38:45 +00:00
MacroArgs.cpp [modules] Stop trying to fake up a linear MacroDirective history. 2015-04-29 23:20:19 +00:00
MacroInfo.cpp Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 14:27:22 +00:00
ModuleMap.cpp Treat module headers wrapped by our builtin headers as implicitly being textual 2016-10-26 01:08:55 +00:00
PPCaching.cpp [PP] Replace some index based for loops with range based ones 2016-10-26 13:06:13 +00:00
PPCallbacks.cpp
PPConditionalDirectiveRecord.cpp Switch PPCallbacks to take the new MacroDefinition instead of MacroDirective*, in order to preserve full information on module macro expansion. 2015-05-04 03:15:40 +00:00
PPDirectives.cpp Do not print include_next/pragma once warnings when input is a header. 2016-10-27 14:17:10 +00:00
PPExpressions.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-09-07 21:53:17 +00:00
PPLexerChange.cpp Fix MSVC warning about missing 'this' from lambda default capture mode 2016-10-27 10:51:29 +00:00
PPMacroExpansion.cpp Accept nullability qualifiers on array parameters. 2016-11-10 23:28:17 +00:00
PTHLexer.cpp Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC) 2016-10-11 07:31:29 +00:00
Pragma.cpp Do not print include_next/pragma once warnings when input is a header. 2016-10-27 14:17:10 +00:00
PreprocessingRecord.cpp Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 14:27:22 +00:00
Preprocessor.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-09-07 21:53:17 +00:00
PreprocessorLexer.cpp
ScratchBuffer.cpp MSan told me that we actually dump the entire scratch buffer into PCH files, initialize it. 2015-04-06 20:01:49 +00:00
TokenConcatenation.cpp [PP] Replace some index based for loops with range based ones 2016-10-26 13:06:13 +00:00
TokenLexer.cpp [PP] Replace some index based for loops with range based ones 2016-10-26 13:06:13 +00:00
UnicodeCharSets.h Header guard canonicalization, clang part. 2014-08-13 16:25:19 +00:00