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:
> xazax.hun wrote:
> > 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?
> It is... debatable. It is not obvious whether the lifetime of the pointed-to 
> memory has ended or not without more detailed lifetime annotations. I think 
> it is fair to silence it, however, I think the comment should be updated to 
> explain the situation in a more detailed way, since without context it looks 
> like a use-after-move.
Do you think renaming `localOwner` to `uniquePtr` would be sufficient or do you 
want me to extend the text too?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64256



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to