================ @@ -1877,16 +1923,43 @@ static bool didPreviousFreeFail(ProgramStateRef State, return false; } +static void printOwnershipTakesList(raw_ostream &os, CheckerContext &C, + const Expr *E) { + if (const CallExpr *CE = dyn_cast<CallExpr>(E)) { + const FunctionDecl *FD = CE->getDirectCallee(); + if (!FD) + return; + + if (!FD->hasAttrs()) + return; + + // Only one ownership_takes attribute is allowed + for (const auto *I : FD->specific_attrs<OwnershipAttr>()) { + OwnershipAttr::OwnershipKind OwnKind = I->getOwnKind(); + + if (OwnKind != OwnershipAttr::Takes) + continue; + + os << ", which takes ownership of " << '\'' << I->getModule()->getName() + << '\''; ---------------- steakhal wrote:
```suggestion os << ", which takes ownership of '" << I->getModule()->getName() << '\''; ``` This way it would even fit into a single line. https://github.com/llvm/llvm-project/pull/98941 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits