[clang] [LifetimeSafety] Implement multi-level origins (PR #168344)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 28 04:47:32 PST 2025
================
@@ -210,11 +317,24 @@ void FactsGenerator::VisitInitListExpr(const InitListExpr *ILE) {
void FactsGenerator::VisitMaterializeTemporaryExpr(
const MaterializeTemporaryExpr *MTE) {
- if (!hasOrigin(MTE))
+ OriginTree *MTETree = getTree(*MTE);
+ OriginTree *SubExprTree = getTree(*MTE->getSubExpr());
+ if (!MTETree)
return;
- // A temporary object's origin is the same as the origin of the
- // expression that initializes it.
- killAndFlowOrigin(*MTE, *MTE->getSubExpr());
+ if (MTE->isGLValue()) {
+ assert(!SubExprTree ||
+ MTETree->getDepth() == SubExprTree->getDepth() + 1 && "todo doc.");
+ // Issue a loan to the MTE.
+ // const Loan *L = createLoan(FactMgr, MTE);
----------------
Xazax-hun wrote:
Nit: commented out code.
https://github.com/llvm/llvm-project/pull/168344
More information about the cfe-commits
mailing list