[clang] Make [[clang::lifetimebound]] work for expressions coming from default arguments (PR #112047)
Boaz Brickner via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 23:23:55 PDT 2024
================
@@ -1383,6 +1394,15 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
<< nextPathEntryRange(Path, I + 1, L);
break;
}
+
+ case IndirectLocalPathEntry::DefaultArg: {
+ const auto *DAE = cast<CXXDefaultArgExpr>(Elem.E);
+ SemaRef.Diag(DAE->getParam()->getDefaultArgRange().getBegin(),
+ diag::note_init_with_default_argument)
+ << DAE->getParam() << nextPathEntryRange(Path, I + 1, L);
----------------
bricknerb wrote:
Seems like we only care about DAE->getParam(), and use it twice, so consider introducing a variable for it instead or in addition to DAE.
https://github.com/llvm/llvm-project/pull/112047
More information about the cfe-commits
mailing list