Author: Timm Bäder
Date: 2023-09-05T10:28:47+02:00
New Revision: 8ad37a894b0b54fe71afa5ea3c003eea6ba76676

URL: 
https://github.com/llvm/llvm-project/commit/8ad37a894b0b54fe71afa5ea3c003eea6ba76676
DIFF: 
https://github.com/llvm/llvm-project/commit/8ad37a894b0b54fe71afa5ea3c003eea6ba76676.diff

LOG: [clang][Interp][NFC] Return array element type in Pointer::getType()

This is irrelevant for the current tests, but makes sense and later
changes easier.

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 7012009c675af2..48aa4df1430fc1 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -212,7 +212,11 @@ class Pointer {
   }
 
   /// Returns the type of the innermost field.
-  QualType getType() const { return getFieldDesc()->getType(); }
+  QualType getType() const {
+    if (inPrimitiveArray() && Offset != Base)
+      return 
getFieldDesc()->getType()->getAsArrayTypeUnsafe()->getElementType();
+    return getFieldDesc()->getType();
+  }
 
   Pointer getDeclPtr() const { return Pointer(Pointee); }
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to