[PATCH] D65127: Even more warnings utilizing gsl::Owner/gsl::Pointer annotations

Matthias Gehre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 30 10:59:11 PDT 2019

mgehre added inline comments.

Comment at: clang/lib/Sema/SemaInit.cpp:6581
+    if (!Callee->getIdentifier()) {
+      auto OO = Callee->getOverloadedOperator();
+      return OO == OverloadedOperatorKind::OO_Subscript ||
xazax.hun wrote:
> If we want to relax the warnings to give more results we could extend the checking of these overloaded operators for annotated types. But this would imply that the user need to have the expected semantics for those types and can only suppress false positives by removing some gsl:::owner/poinnter annotations.
I see those options:
- Either gsl::Owner implies some specific form of those operators (and if that does not hold for a class, then one should not annotate it with gsl::Owner)
- or gsl::Owner only implies some specific behavior for the "gsl::Pointer constructed from gsl::Owner" case and everything else requires additional annotation
I expect that we will experiment a bit in the future to see what works well for real-world code.



More information about the cfe-commits mailing list