================
@@ -145,6 +145,16 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo 
&TI,
   //  - IsIntType: enforces any integer type
   // Lambdas centralize type checks for BCD builtin handlers
 
+  // reject calls with more args than the builtin's declared prototype
----------------
im-lunex wrote:

>I worry for folks adding new builtins later which follow the pattern used 
>outside of the PPC builtins.

okay if i am not wrong, what you are saying here is if someone uses the 
variadic pattern, i think this check

```
(!FPT->isVariadic() &&
    SemaRef.checkArgCountAtMost(TheCall, FPT->getNumParams()))
```

should catch that.. for Variadic prototype the check will be skipped totally.

>Would it be viable to disable custom type checking for these builtins instead?

fair point. However, thats a larger refactor because these builtins use 
`BuiltinConstantArgRange` to enforce immediate value constraints (Arg2 must be 
0 or 1 kind of things) which cant be expressed in the prototype string - think 
that would be much more of work to do.. but this could be a good follow-up.

THANKS a lot for the review.!




https://github.com/llvm/llvm-project/pull/222841
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to