[clang-tools-extra] [clang-tidy] Allow type-generic builtins in pro-type-vararg check (PR #178656)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 31 05:26:09 PST 2026


================
@@ -178,6 +178,16 @@ void ProTypeVarargCheck::check(const MatchFinder::MatchResult &Result) {
   if (const auto *Matched = Result.Nodes.getNodeAs<CallExpr>("callvararg")) {
     if (hasSingleVariadicArgumentWithValue(Matched, 0))
       return;
+
+    // Skip builtins with custom type checking - they use variadics as an
+    // implementation detail to accept multiple types, not for C-style varargs.
+    if (const auto *FD = Matched->getDirectCallee()) {
+      if (const unsigned BuiltinID = FD->getBuiltinID()) {
----------------
zeyi2 wrote:

Small nit: The nesting here is getting a bit deep. Since we just want to early return, we could flatten this by combining the check for BuiltinID.

```c++
if (const unsigned BuiltinID = FD->getBuiltinID();
    BuiltinID && Result.Context->BuiltinInfo.hasCustomTypechecking(BuiltinID))
  return;
```



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


More information about the cfe-commits mailing list