================
@@ -1509,16 +1509,15 @@ void Sema::AddAllocAlignAttr(Decl *D, const
AttributeCommonInfo &CI,
}
ParamIdx Idx;
- const auto *FuncDecl = cast<FunctionDecl>(D);
- if (!checkFunctionOrMethodParameterIndex(FuncDecl, CI,
+ if (!checkFunctionOrMethodParameterIndex(D, CI,
/*AttrArgNum=*/1, ParamExpr, Idx))
return;
QualType Ty = getFunctionOrMethodParamType(D, Idx.getASTIndex());
if (!Ty->isDependentType() && !Ty->isIntegralType(Context) &&
!Ty->isAlignValT()) {
Diag(ParamExpr->getBeginLoc(), diag::err_attribute_integers_only)
- << CI << FuncDecl->getParamDecl(Idx.getASTIndex())->getSourceRange();
+ << CI << getFunctionOrMethodParamRange(D, Idx.getASTIndex());
----------------
AaronBallman wrote:
Ohhhhh I see what you're saying now, thank you! Yeah, there could be a
parameter declaration, a field declaration, etc.
In that case we'd have to go back to the `TypeSourceInfo *` so we could get a
`FunctionTypeLoc` ... and from there we should be able to get a `ParmVarDecl`
that has a valid source location.
https://github.com/llvm/llvm-project/pull/210871
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits