Introduce type nullability specifiers for C/C++.

Description

Introduce type nullability specifiers for C/C++.

Introduces the type specifiers nonnull, nullable, and
__null_unspecified that describe the nullability of the pointer type
to which the specifier appertains. Nullability type specifiers improve
on the existing nonnull attributes in a few ways:

  • They apply to types, so one can represent a pointer to a non-null pointer, use them in function pointer types, etc.
  • As type specifiers, they are syntactically more lightweight than attributes or [[attribute]]s.
  • They can express both the notion of 'should never be null' and also 'it makes sense for this to be null', and therefore can more easily catch errors of omission where one forgot to annotate the nullability of a particular pointer (this will come in a subsequent patch).

Nullability type specifiers are maintained as type sugar, and
therefore have no effect on mangling, encoding, overloading,
etc. Nonetheless, they will be used for warnings about, e.g., passing
'null' to a method that does not accept it.

This is the C/C++ part of rdar://problem/18868820.

Details

Committed
dgregorJun 19 2015, 10:51 AM
Parents
rL240145: MIR Serialization: Serialize the list of machine basic blocks with simpleā€¦
Branches
Unknown
Tags
Unknown