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

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 04:02:48 PDT 2019


gribozavr added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:6581
+    if (!Callee->getIdentifier()) {
+      auto OO = Callee->getOverloadedOperator();
+      return OO == OverloadedOperatorKind::OO_Subscript ||
----------------
mgehre wrote:
> 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.
I understand the difficulty, but I don't think it is appropriate to experiment by ourselves -- these attributes are defined in a spec, and if something is not clear, the spec should be clarified.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65127/new/

https://reviews.llvm.org/D65127





More information about the cfe-commits mailing list