gribozavr added inline comments.
================
Comment at: clang/lib/Sema/SemaInit.cpp:6572
+ return false;
+ return llvm::StringSwitch<bool>(Callee->getName())
+ .Cases("begin", "rbegin", "cbegin", "crbegin", true)
----------------
xazax.hun wrote:
> gribozavr wrote:
> > Should we also check that `Callee->getParent` is an owner?
> >
> > Otherwise the check would complain about `begin()` on, for example, a
> > `std::string_view`.
> This is intentional. We only warn if the initialization chain can be tracked
> back to a temporary (or local in some cases) owner.
> So we warn for the following code:
> ```
> const char *trackThroughMultiplePointer() {
> return std::basic_string_view<char>(std::basic_string<char>()).begin(); //
> expected-warning {{returning address of local temporary object}}
> }
> ```
Makes sense, but then we should still check that `Callee->getParent` is an
owner or a pointer.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65120/new/
https://reviews.llvm.org/D65120
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits