================ @@ -3542,6 +3542,59 @@ bool CallExpr::isBuiltinAssumeFalse(const ASTContext &Ctx) const { Arg->EvaluateAsBooleanCondition(ArgVal, Ctx) && !ArgVal; } +const AllocSizeAttr *CallExpr::getAllocSizeAttr() const { + if (const FunctionDecl *DirectCallee = getDirectCallee()) + return DirectCallee->getAttr<AllocSizeAttr>(); + if (const Decl *IndirectCallee = getCalleeDecl()) + return IndirectCallee->getAttr<AllocSizeAttr>(); + return nullptr; ---------------- AaronBallman wrote:
I think that's something we could encode in the tablegen file for builtins; we already encode things like `const` attributes. Then when the (lib)builtin declaration is formed, we would already have the attribute present and this logic would just work. https://github.com/llvm/llvm-project/pull/150028 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits