================
@@ -632,13 +579,45 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
ArrayRef<const Expr *> Args,
bool IsGslConstruction) {
OriginList *CallList = getOriginsList(*Call);
+ SourceManager &SM = AC.getASTContext().getSourceManager();
+ // To avoid over-reporting, we assume the following are noescape:
+ // - All parameters to functions declared in the system headers
+ // - The implicit `this` parameter for member functions
+ auto IsArgNoEscape = [FD, &SM](unsigned I) -> bool {
+ const ParmVarDecl *PVD = nullptr;
+ if (const auto *Method = dyn_cast<CXXMethodDecl>(FD);
+ Method && Method->isInstance()) {
+ // There is currently no way to declare 'this' is noescape for member
+ // functions We therefore return true as the user cannot do anything via
+ // annotation, so we make the conservative approximation
+ if (I == 0) {
----------------
Xazax-hun wrote:
Nit: omit braces for simple, one statement if statements.
https://github.com/llvm/llvm-project/pull/186126
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits