[clang] [clang][bytecode] Strip atomicity in Descriptor::getElemQualType() (PR #181328)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 23:58:59 PST 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/181328
The later check for VectorType fails otherwise.
>From 2de08b8f15e2417ce2af3b3ae177cca03d5c2329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 13 Feb 2026 08:57:38 +0100
Subject: [PATCH] [clang][bytecode] Strip atomicity in
Descriptor::getElemQualType()
The later check for VectorType fails otherwise.
---
clang/lib/AST/ByteCode/Descriptor.cpp | 2 ++
clang/test/AST/ByteCode/vectors.cpp | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/clang/lib/AST/ByteCode/Descriptor.cpp b/clang/lib/AST/ByteCode/Descriptor.cpp
index a3cee034191d2..5ebc726328fb7 100644
--- a/clang/lib/AST/ByteCode/Descriptor.cpp
+++ b/clang/lib/AST/ByteCode/Descriptor.cpp
@@ -388,6 +388,8 @@ QualType Descriptor::getType() const {
QualType Descriptor::getElemQualType() const {
assert(isArray());
QualType T = getType();
+ if (const auto *AT = T->getAs<AtomicType>())
+ T = AT->getValueType();
if (T->isPointerOrReferenceType())
T = T->getPointeeType();
diff --git a/clang/test/AST/ByteCode/vectors.cpp b/clang/test/AST/ByteCode/vectors.cpp
index 2eb615e906cf5..db18d8360f36a 100644
--- a/clang/test/AST/ByteCode/vectors.cpp
+++ b/clang/test/AST/ByteCode/vectors.cpp
@@ -39,6 +39,10 @@ static_assert(arr4[1][0] == 0, "");
constexpr VI4 B = __extension__(A);
+/// Can initialize atomic vectors.
+typedef char vs4 __attribute__((vector_size(4)));
+constexpr _Atomic vs4 foo = (vs4)0xDEADBEEF;
+
/// From constant-expression-cxx11.cpp
namespace Vector {
typedef int __attribute__((vector_size(16))) VI4;
More information about the cfe-commits
mailing list