[clang] [clang] Diagnose dangling references for parenthesized aggregate initialization. (PR #117690)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 07:08:34 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();
----------------
hokein wrote:
Done.
https://github.com/llvm/llvm-project/pull/117690
More information about the cfe-commits
mailing list