[LangRef] Clarify `dereferenceable` -> `nonnull` implication

If `null_pointer_is_valid` is present, `dereferenceable` does not imply
`nonnull`, make it clear.

Came up in D17993.

Reviewed By: aqjune

Differential Revision: https://reviews.llvm.org/D89417
This commit is contained in:
Johannes Doerfert 2020-10-14 13:54:20 -05:00
parent b1a90e1599
commit 14077836ec
1 changed files with 2 additions and 1 deletions

View File

@ -1234,7 +1234,8 @@ Currently, only the following parameter attributes are defined:
size of the pointee type. The ``nonnull`` attribute does not imply
dereferenceability (consider a pointer to one element past the end of an
array), however ``dereferenceable(<n>)`` does imply ``nonnull`` in
``addrspace(0)`` (which is the default address space).
``addrspace(0)`` (which is the default address space), except if the
``null_pointer_is_valid`` function attribute is present.
``dereferenceable_or_null(<n>)``
This indicates that the parameter or return value isn't both