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

Lawrence Benson via libc-commits libc-commits at lists.llvm.org
Mon Oct 16 09:11:32 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;
----------------
lawben wrote:

Done

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


More information about the libc-commits mailing list