[clang] [clang] Diagnose dangling references for parenthesized aggregate initialization. (PR #117690)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 05:50:08 PST 2024
================
@@ -961,6 +963,17 @@ static void visitLocalsRetainedByInitializer(IndirectLocalPath &Path,
if (isa<CallExpr>(Init) || isa<CXXConstructExpr>(Init))
return visitFunctionCallArguments(Path, Init, Visit);
+ if (auto *CPE = dyn_cast<CXXParenListInitExpr>(Init)) {
+ Path.push_back({IndirectLocalPathEntry::ParenAggInit, CPE});
+ for (auto *I : CPE->getInitExprs()) {
+ if (I->isGLValue())
+ visitLocalsRetainedByReferenceBinding(Path, I, RK_ReferenceBinding,
+ Visit);
+ else
+ visitLocalsRetainedByInitializer(Path, I, Visit, true);
+ }
+ Path.pop_back();
----------------
usx95 wrote:
nit: Use `RevertToOldSizeRAII`.
https://github.com/llvm/llvm-project/pull/117690
More information about the cfe-commits
mailing list