[clang] [clang][Sema] Handle alloc_align on all HasFunctionProto declarations (PR #210871)

Mimis Chlympatsos via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 22:02:42 PDT 2026


================
@@ -77,6 +82,33 @@ inline const ParmVarDecl *getFunctionOrMethodParam(const Decl *D,
     return MD->getParamDecl(Idx);
   if (const auto *BD = dyn_cast<BlockDecl>(D))
     return BD->getParamDecl(Idx);
+
+  // Handle declarations that do not directly own parameters but have an
----------------
mimischly7 wrote:

I tried to mirror the cases handled by `Decl::getFunctionType()` from `clang/lib/AST/DeclBase.cpp`. My thinking if there is some `Decl` that is not handled by `Decl::getFunctionType()`, then it should not be expected that it is handled by `getFunctionOrMethodParam()`, which tends to be below `Decl::getFunctionType()` in the chain. For alloc_align attribute, `Decl::getFunctionType()` is called on the Decl first (through `getFunctionOrMethodResultType`) and if that returns nullptr then the call to `getFunctionOrMethodParam()` is not not even reached.



https://github.com/llvm/llvm-project/pull/210871


More information about the cfe-commits mailing list