[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 13:11:35 PDT 2025


================
@@ -2279,6 +2280,20 @@ static bool CheckMaskedBuiltinArgs(Sema &S, Expr *MaskArg, Expr *PtrArg,
   if (!PtrTy->isPointerType() || PtrTy->getPointeeType()->isVectorType())
     return S.Diag(PtrArg->getExprLoc(), diag::err_vec_masked_load_store_ptr)
            << Pos << "scalar pointer";
+
+  QualType PointeeTy = PtrTy->getPointeeType();
+  if (PointeeTy.isVolatileQualified() || PointeeTy->isAtomicType() ||
+      (!AllowConst && PointeeTy.isConstQualified()) ||
+      (!AllowAS && PointeeTy.hasAddressSpace())) {
+    QualType Target = S.Context.getPointerType(PointeeTy.getUnqualifiedType());
+    if (const auto *AT = dyn_cast<AtomicType>(PointeeTy))
+      Target = S.Context.getPointerType(AT->getValueType());
----------------
rjmccall wrote:

`QualType Target = S.Context.getPointerType(PointeeTy.getAtomicUnqualifiedType());`

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


More information about the cfe-commits mailing list