[libcxx-commits] [libcxx] [Clang] Add __builtin_vectorelements to get number of elements in vector (PR #69010)

Erich Keane via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 13 09:58:07 PDT 2023


================
@@ -4351,6 +4352,17 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T,
   return false;
 }
 
+static bool CheckVectorElementsTraitOperandType(Sema &S, QualType T,
+                                                SourceLocation Loc,
+                                                SourceRange ArgRange) {
+  // builtin_vectorelements supports both fixed-sized and scalable vectors.
+  if (!T->isVectorType() && !T->isSizelessVectorType()) {
+    S.Diag(Loc, diag::err_vectorelements_non_vector) << T << ArgRange;
----------------
erichkeane wrote:

remove the curleys and just do: `return S.Diag`

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


More information about the libcxx-commits mailing list