[PATCH] D25850: [WIP] Accept nullability annotations (_Nullable) on array parameters

Jordan Rose via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 17:09:56 PDT 2016


jordan_rose created this revision.
jordan_rose added reviewers: aprantl, doug.gregor.
jordan_rose added a subscriber: cfe-commits.
jordan_rose set the repository for this revision to rL LLVM.

Last year Apple added new qualifiers to pointer types: `_Nullable`, `_Nonnull`, and `_Null_unspecified`. This patch extends that to array types used in function declarations, which should have always been supported since they immediately decay to pointers.

I'm not really happy with the invariants I've had to break for this to work, though. Previously a DecayedType always contained a PointerType; now it may contain an AttributedType wrapped around a PointerType. Are there any other places where this is going to cause problems besides debug info?

Still to do:

- Tests (I've been ad-hoc testing with -ast-dump)
- Probably fix up cases involving typedefs
- Figure out how this affects `#pragma clang assume_nonnull` (in a follow-up commit)

Part of rdar://problem/25846421


Repository:
  rL LLVM

https://reviews.llvm.org/D25850

Files:
  include/clang/AST/Type.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/Parse/ParseDecl.cpp
  lib/Sema/SemaAPINotes.cpp
  lib/Sema/SemaType.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25850.75370.patch
Type: text/x-patch
Size: 8293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161021/936b7e46/attachment.bin>


More information about the cfe-commits mailing list