This is an archive of the discontinued LLVM Phabricator instance.

Don't require nullability on template parameters in typedefs.
ClosedPublic

Authored by jordan_rose on Nov 1 2016, 6:27 PM.

Details

Summary

Previously the following code would warn on the use of T:

template <typename T>
struct X {
  typedef T *type;
};

...because nullability is allowed on template parameters (because they could be pointers). (Actually putting nullability on this use of T will of course break if the argument is a non-pointer type.)

This fix doesn't handle the case where a template parameter is used outside of a typedef. That seems trickier, especially in parameter position.

Diff Detail

Repository
rL LLVM

Event Timeline

jordan_rose updated this revision to Diff 76663.Nov 1 2016, 6:27 PM
jordan_rose retitled this revision from to Don't require nullability on template parameters in typedefs..
jordan_rose updated this object.
jordan_rose added reviewers: doug.gregor, rsmith.
jordan_rose set the repository for this revision to rL LLVM.
jordan_rose added a subscriber: cfe-commits.
doug.gregor accepted this revision.Nov 1 2016, 10:57 PM
doug.gregor edited edge metadata.

Seem fine; I'd rename the "FIXME" to a "Note" unless you're going to pass a flag to Type::canHaveNullability to say how to classify dependent types.

This revision is now accepted and ready to land.Nov 1 2016, 10:57 PM
jordan_rose closed this revision.Nov 2 2016, 1:56 PM

Committed in r285856.