[clang] [LifetimeSafety] Flow origins from lifetimebound args in `gsl::Pointer` construction (PR #189907)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 1 05:41:50 PDT 2026
================
@@ -704,10 +704,10 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
assert(!Args[I]->isGLValue() || ArgList->getLength() >= 2);
ArgList = getRValueOrigins(Args[I], ArgList);
}
- if (isGslOwnerType(Args[I]->getType())) {
- // The constructed gsl::Pointer borrows from the Owner's storage, not
- // from what the Owner itself borrows, so only the outermost origin is
- // needed.
+ if (isGslOwnerType(Args[I]->getType()) || IsArgLifetimeBound(I)) {
+ // The constructed gsl::Pointer is dependent on the argument itself, not
----------------
NeKon69 wrote:
I just enabled `llvm::DebugFlag` and it dumps AST, CFG and flow facts. So that is fine.
About your other test now, I think it doesn't print any warnings because it falls under [a different case](https://github.com/llvm/llvm-project/blob/ab4b689258c21c5e47d1a865b8b980e01395aac7/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp#L575-L683) in
```cpp
void FactsGenerator::handleGSLPointerConstruction(const CXXConstructExpr *CCE)
```
and it doesn't flow there. But I can't use `flow` there because the origin lengths are different.
https://github.com/llvm/llvm-project/pull/189907
More information about the cfe-commits
mailing list