[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 Aug 6 08:43:16 PDT 2019


xazax.hun marked an inline comment as done.
xazax.hun added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:7077
+    //   someContainer.add(std::move(localOWner));
+    //   return p;
+    if (!IsTempGslOwner && pathOnlyInitializesGslPointer(Path) &&
----------------
gribozavr wrote:
> Why is it a false positive? `std::move` left memory owned by `localOwner` in unspecified state.
I saw user code relying on the semantics of certain classes. E.g. they assume if a `std::unique_ptr` is moved the pointee is still in place, so it is safe to return a reference to the pointee. Do you think those cases should be diagnosed too?


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

https://reviews.llvm.org/D64256





More information about the cfe-commits mailing list