[clang] [LifetimeSafety] Implement multi-level origins (PR #168344)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 15 06:11:44 PST 2025
================
@@ -133,24 +191,49 @@ void FactsGenerator::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *N) {
/// TODO: Handle nullptr expr as a special 'null' loan. Uninitialized
/// pointers can use the same type of loan.
- FactMgr.getOriginMgr().getOrCreate(*N);
+ getOriginsList(*N);
}
void FactsGenerator::VisitImplicitCastExpr(const ImplicitCastExpr *ICE) {
- if (!hasOrigin(ICE))
+ OriginList *Dest = getOriginsList(*ICE);
+ if (!Dest)
+ return;
+ OriginList *SrcList = getOriginsList(*ICE->getSubExpr());
+
+ switch (ICE->getCastKind()) {
+ case CK_LValueToRValue:
+ // TODO: Decide what to do for x-values here.
+ if (!ICE->getSubExpr()->isLValue())
+ return;
+
+ assert(SrcList && "LValue being cast to RValue has no origin list");
+ // The result of an LValue-to-RValue cast on a reference-to-pointer like
----------------
ymand wrote:
nit: missing word after "like"?
https://github.com/llvm/llvm-project/pull/168344
More information about the cfe-commits
mailing list