================
@@ -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>())
----------------
usx95 wrote:

\+1. The reporting at the end should take care of not suggesting already 
annotated params instead of dropping the placeholder loans.

These loans would also help us improve C++ coverage metric: "Origins with no 
loans". It seems helpful to differentiate between the case when origins hold 
placeholders vs origins hold no loans (because of being either unknown of 
analysis bug). So these loans serve mutliple purposes beyond lifetime 
suggestions alone.

https://github.com/llvm/llvm-project/pull/169767
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to