[clang] 1f5cd3a - [clang][Interp][NFC] Fix getType() of pointers pointing to vector elems

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 02:59:08 PDT 2024


Author: Timm Bäder
Date: 2024-05-22T11:58:46+02:00
New Revision: 1f5cd3accd7e98abbf31d45b1ed59fbda0c91d30

URL: https://github.com/llvm/llvm-project/commit/1f5cd3accd7e98abbf31d45b1ed59fbda0c91d30
DIFF: https://github.com/llvm/llvm-project/commit/1f5cd3accd7e98abbf31d45b1ed59fbda0c91d30.diff

LOG: [clang][Interp][NFC] Fix getType() of pointers pointing to vector elems

Added: 
    

Modified: 
    clang/lib/AST/Interp/Pointer.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index 3ade5756e580e..9468bdbf00cc0 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -314,12 +314,14 @@ class Pointer {
   /// Returns the type of the innermost field.
   QualType getType() const {
     if (inPrimitiveArray() && Offset != asBlockPointer().Base) {
-      // Unfortunately, complex types are not array types in clang, but they are
-      // for us.
+      // Unfortunately, complex and vector types are not array types in clang,
+      // but they are for us.
       if (const auto *AT = getFieldDesc()->getType()->getAsArrayTypeUnsafe())
         return AT->getElementType();
       if (const auto *CT = getFieldDesc()->getType()->getAs<ComplexType>())
         return CT->getElementType();
+      if (const auto *CT = getFieldDesc()->getType()->getAs<VectorType>())
+        return CT->getElementType();
     }
     return getFieldDesc()->getType();
   }


        


More information about the cfe-commits mailing list