================
@@ -104,6 +104,35 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo
&TI,
return Diag(TheCall->getBeginLoc(), diag::err_64_bit_builtin_32_bit_tgt)
<< TheCall->getSourceRange();
+ // Common BCD type-validation helpers
+ // Emit diagnostics and return true on failure
+ // - VerifyVectorType: enforces vector unsigned char
+ // - VerifyIntType: enforces any integer type
+ // Lambdas centralize type checks for BCD builtin handlers
+ QualType VecType = Context.getVectorType(Context.UnsignedCharTy, 16,
+ VectorKind::AltiVecVector);
+ // Lambda 1: verify vector type
+ auto VerifyVectorType = [&](QualType ArgTy, SourceLocation Loc,
+ unsigned ArgIndex) -> bool {
+ if (!Context.hasSameType(ArgTy, VecType)) {
+ Diag(Loc, diag::err_ppc_invalid_vector_type)
----------------
lei137 wrote:
I don't we need to pass in a `Loc` each time we call these lambdas.
Just code it into the func same way it's being used all through this functions
```suggestion
Diag(TheCall->getBeginLoc(), diag::err_ppc_invalid_vector_type)
```
https://github.com/llvm/llvm-project/pull/154715
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits