[clang] [Sema] Check arg count for builtins with CustomTypeChecking (PR #222841)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 12:49:00 PDT 2026


================
@@ -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
----------------
AaronBallman wrote:

Hmm, I can see it going either way. It's certainly less readable, particularly because there's no way to see that's what `__vector` expands to. e.g., when you preprocess the source code, it's not a macro that expands to that. But I feel like this is related to other questions I had about whether the `vector` keyword is actually implemented correctly (for behavior like https://godbolt.org/z/ExaGG59Pe); `__vector` is a keyword in TokenKinds.def but it seems `vector` is a hack based on a much earlier hack to support Altivec:

https://github.com/llvm/llvm-project/blob/aa261b730fe1dd212160de5ba64ed2a71a20b72c/clang/lib/Parse/Parser.cpp#L533
https://github.com/llvm/llvm-project/blob/aa261b730fe1dd212160de5ba64ed2a71a20b72c/clang/lib/Parse/ParseDecl.cpp#L8184

and so I suspect there's more work to be done to really clean the feature up, and fixing the way diagnostics are printed for this may be one of those cleanup tasks.

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


More information about the cfe-commits mailing list