[clang] [clang][bytecode] Strip atomicity in Descriptor::getElemQualType() (PR #181328)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 23:59:33 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
The later check for VectorType fails otherwise.
---
Full diff: https://github.com/llvm/llvm-project/pull/181328.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Descriptor.cpp (+2)
- (modified) clang/test/AST/ByteCode/vectors.cpp (+4)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/181328
More information about the cfe-commits
mailing list