[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 09:05:56 PDT 2019


xazax.hun marked 6 inline comments as done.
xazax.hun added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:7076
+        auto Prefix = llvm::makeArrayRef(Path).drop_back();
+      if (pathInitializeLifetimePointer(Prefix))
+        IsLifetimePtrInitWithTempOwner = true;
----------------
gribozavr wrote:
> Is it important that the whole path only contains gsl::Pointer nodes?
We are trying to figure out what do we initialize a `gsl::Pointer` annotated class. The reason why we have multiple `GslPointerInit`s in the path is that we usually can see a lot of intermediate temporary objects. Looking at the AST of the examples I have so far the other kind of paths does not seem to be relevant. I can imagine refining this condition later after examining a false negative but I think starting with the most conservative approach should be reasonable for warnings. 


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

https://reviews.llvm.org/D64256





More information about the cfe-commits mailing list