[clang] [LifetimeSafety] Track origins through nested subobject fields (PR #232867)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 16 13:04:19 PDT 2026
================
@@ -1211,15 +1211,30 @@ void FactsGenerator::handleUse(const Expr *E) {
// class and its bases. It represents the storage the field refers to, as
// opposed to the field itself (covered by $this).
void FactsGenerator::issueFieldPlaceholderLoans(
- const CXXMethodDecl *MD, llvm::SmallVectorImpl<Fact *> &Facts) {
- const CXXRecordDecl *ClassDecl = MD->getParent()->getDefinition();
- if (!ClassDecl)
- return;
+ const CXXRecordDecl *ClassDef, llvm::SmallVectorImpl<Fact *> &Facts) {
+ assert(ClassDef);
----------------
steakhal wrote:
This `assert` documents the precondition.
I could nest the check inside here - but I figured it's a reasonable assumption - hence I hoisted it to the callsite.
I have considered having a dispatching overload that would go from a MethodDecl to ClassDecl, but decided against to keep the public interface narrow.
https://github.com/llvm/llvm-project/pull/232867
More information about the cfe-commits
mailing list