[clang] [LifetimeSafety] Suggest lifetime annotations (PR #169767)
Kashika Akhouri via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 28 02:24:25 PST 2025
================
@@ -342,4 +347,27 @@ void FactsGenerator::markUseAsWrite(const DeclRefExpr *DRE) {
UseFacts[DRE]->markAsWritten();
}
+// Creates an IssueFact for a new placeholder loan for each pointer or reference
+// parameter at the function's entry.
+llvm::SmallVector<Fact *> FactsGenerator::createPlaceholderLoanFacts() {
+ llvm::SmallVector<Fact *> PlaceholderLoanFacts;
+ const auto *FD = dyn_cast<FunctionDecl>(AC.getDecl());
+ if (!FD)
+ return PlaceholderLoanFacts;
+
+ for (const ParmVarDecl *PVD : FD->parameters()) {
+ QualType ParamType = PVD->getType();
+ if (PVD->hasAttr<LifetimeBoundAttr>())
----------------
kashika0112 wrote:
Okay, have moved this check to the reporting function.
https://github.com/llvm/llvm-project/pull/169767
More information about the cfe-commits
mailing list