[clang] Make [[clang::lifetimebound]] work for expressions coming from default arguments (PR #112047)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 09:51:04 PDT 2024
================
@@ -465,17 +466,27 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call,
for (unsigned I = 0,
N = std::min<unsigned>(Callee->getNumParams(), Args.size());
I != N; ++I) {
+ Expr *Arg = Args[I];
+ auto *DAE = dyn_cast<CXXDefaultArgExpr>(Arg);
+ if (DAE) {
+ Path.push_back(
+ {IndirectLocalPathEntry::DefaultArg, DAE, DAE->getParam()});
+ Arg = DAE->getExpr();
+ }
----------------
usx95 wrote:
You can use `RevertToOldSizeRAII` to do the `pop_back` for you. This way you can write
`if (auto *DAE = dyn_cast<CXXDefaultArgExpr>(Arg)) {...}`
https://github.com/llvm/llvm-project/pull/112047
More information about the cfe-commits
mailing list