Fix assertion failure "PathDiagnosticSpotPiece's must have a valid location." in...
authorArseniy Zaostrovnykh <arseniy.zaostrovnykh@sonarsource.com>
Thu, 26 Jan 2023 16:19:04 +0000 (17:19 +0100)
committerBalazs Benics <benicsbalazs@gmail.com>
Thu, 26 Jan 2023 16:26:05 +0000 (17:26 +0100)
commit98d55095d85129c2776a9d7a227c5f88e3ce2e01
tree98c00429ce1dd4afaa2cd6455e3cc03845435a9a
parentd4f4b2fe21dddff023aeab775dd63b321e23f918
Fix assertion failure "PathDiagnosticSpotPiece's must have a valid location." in ReturnPtrRange checker on builtin functions

Builtin functions (such as `std::move`, `std::forward`, `std::as_const`)
have a body generated during the analysis not related to any source file
so their statements have no valid source locations.
`ReturnPtrRange` checker should not report issues for these builtin
functions because they only forward its parameter and do not create any
new pointers.

Fixes #55347

Patch by Arseniy Zaostrovnykh.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D138713
clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
clang/test/Analysis/return-ptr-range.cpp