Joint work with @xazax.hun.
This is the first part of work announced in
"[RFC] Adding lifetime analysis to clang" [0],
i.e. the addition of the [[gsl::Owner(T)]] and
[[gsl::Pointer(T)]] attributes, which
will enable user-defined types to participate in
the lifetime analysis (which will be part of the
next PR).
The type T here is called "DerefType" in the paper,
and denotes the type that an Owner owns and a Pointer
points to. E.g. std::vector<int> should be annotated
with [[gsl::Owner(int)]] and
a std::vector<int>::iterator with [[gsl::Pointer(int)]].
We explicitly allow to add an annotation after
the definition of the class to allow adding annotations
to external source from by the user, e.g.
#include <vector> namespace std { template<typename T, typename Alloc> class [[gsl::Owner(T)]] vector; }
until we can ship a standard library with annotations.
[0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html
"and is currently ignored"
even better:
"and is ignored"
It does not matter for the user that we might change it in future. We might change *anything* in future, and yet we don't hedge everywhere.