[clang] [clang] Fix the post-filtering heuristic for GSLPointer. (PR #114044)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 02:43:06 PST 2024
hokein wrote:
> Just discover a new false positive:
>
> ```
> namespace std {
> template <typename T>
> class [[gsl::Pointer]] Iterator2 {
> public:
> using reference = T&;
> Iterator2() {}
> reference operator*() const;
> };
> }
>
> template <typename T>
> class AnySpan {
> public:
> AnySpan() {}
> std::Iterator2<T> begin() const [[clang::lifetimebound]];
> };
>
> AnySpan<int> MakeAnySpan();
> void s() {
> const int& t2 = *AnySpan<int>().begin(); // false positive, warning.
> }
> ```
Fix it in the latest commit https://github.com/llvm/llvm-project/pull/114044/commits/85e08706d4b9cfd6d419e486cdf1034c1dc1a45d, it would be nice to take another look at the patch, @Xazax-hun, @usx95.
https://github.com/llvm/llvm-project/pull/114044
More information about the cfe-commits
mailing list