[clang] [Clang][FIX] Fix type qualifiers on vector builtins (PR #160185)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 25 14:09:19 PDT 2025


https://github.com/rjmccall commented:

Thanks, that's the right idea. You do need to (1) do the conversions and (2) bail out on `isTypeDependent()` for *all* of the arguments, though. Maybe just add a helper function like `checkArgCount` — `convertArgsToRValues`? — that you can call as the first thing in each of these paths? Something that can be used like

```
  if (convertArgsToRValues(S, TheCall)) return ExprError();
  if (TheCall->isTypeDependent()) return TheCall;
  // Great, you can finally just do the logic like normal.
```

Please add tests for templates, ObjC properties, and passing an array reference as the pointer argument.  A template test case would be something like:

```
template <class T, class V>
V masked_load8(const T *ptr, v8b mask, V value) {
  return __builtin_masked_load(mask, ptr, value); // shouldn't be invalid, but should instantiate correctly
}

v8i test_masked_load_int(v8b mask, v8i v, const int *ptr) {
  return masked_load8(mask, ptr, v);
}

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


More information about the cfe-commits mailing list