[clang] 2435a68 - [clang][bytecode] Strip atomicity in Descriptor::getElemQualType() (#181328)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 01:18:38 PST 2026


Author: Timm Baeder
Date: 2026-02-13T10:18:34+01:00
New Revision: 2435a6856b92fad20e8e121c0e1e0270180b9e06

URL: https://github.com/llvm/llvm-project/commit/2435a6856b92fad20e8e121c0e1e0270180b9e06
DIFF: https://github.com/llvm/llvm-project/commit/2435a6856b92fad20e8e121c0e1e0270180b9e06.diff

LOG: [clang][bytecode] Strip atomicity in Descriptor::getElemQualType() (#181328)

The later check for VectorType fails otherwise.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Descriptor.cpp
    clang/test/AST/ByteCode/vectors.cpp

Removed: 
    


################################################################################
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