Author: Timm Bäder
Date: 2023-11-15T13:40:16+01:00
New Revision: c3329b1cac3158bba62aab14d648b9dc615f8c67

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

LOG: [clang][Interp][NFC] Limit Pointer::isArrayElement() to actual arrays

Similar to what we do in isArrayRoot() - only return true here if the
Pointee is actually of array type.

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 843bcad16b5d1e3..a8f6e62fa76d356 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -279,7 +279,7 @@ class Pointer {
     return getFieldDesc()->isUnknownSizeArray();
   }
   /// Checks if the pointer points to an array.
-  bool isArrayElement() const { return Base != Offset; }
+  bool isArrayElement() const { return inArray() && Base != Offset; }
   /// Pointer points directly to a block.
   bool isRoot() const {
     return (Base == 0 || Base == RootPtrMark) && Offset == 0;


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

Reply via email to