[ffi] Remove deprecated `Pointer.elementAt`

Bug: https://github.com/dart-lang/sdk/issues/54250

TEST=tests/ffi

CoreLibraryReviewExempt: Removing deprecated member after 1+ year.
Change-Id: I2234f28126e0788860a54cbe6aa82bc76b49c8d8
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-mac-debug-simarm64_arm64-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421740
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
diff --git a/pkg/vm/lib/modular/transformations/ffi/common.dart b/pkg/vm/lib/modular/transformations/ffi/common.dart
index 287532c..196da55 100644
--- a/pkg/vm/lib/modular/transformations/ffi/common.dart
+++ b/pkg/vm/lib/modular/transformations/ffi/common.dart
@@ -248,20 +248,16 @@
   final Procedure structPointerRefWithFinalizerTearoff;
   final Procedure structPointerGetElemAt;
   final Procedure structPointerSetElemAt;
-  final Procedure structPointerElementAt;
   final Procedure structPointerPlusOperator;
   final Procedure structPointerMinusOperator;
-  final Procedure structPointerElementAtTearoff;
   final Procedure unionPointerGetRef;
   final Procedure unionPointerSetRef;
   final Procedure unionPointerRefWithFinalizer;
   final Procedure unionPointerRefWithFinalizerTearoff;
   final Procedure unionPointerGetElemAt;
   final Procedure unionPointerSetElemAt;
-  final Procedure unionPointerElementAt;
   final Procedure unionPointerPlusOperator;
   final Procedure unionPointerMinusOperator;
-  final Procedure unionPointerElementAtTearoff;
   final Procedure uint8PointerAsTypedList;
   final Constructor arrayListConstructor;
   final Constructor arrayArrayListConstructor;
@@ -278,10 +274,8 @@
   final Procedure abiSpecificIntegerPointerSetValue;
   final Procedure abiSpecificIntegerPointerElemAt;
   final Procedure abiSpecificIntegerPointerSetElemAt;
-  final Procedure abiSpecificIntegerPointerElementAt;
   final Procedure abiSpecificIntegerPointerPlusOperator;
   final Procedure abiSpecificIntegerPointerMinusOperator;
-  final Procedure abiSpecificIntegerPointerElementAtTearoff;
   final Procedure abiSpecificIntegerArrayElemAt;
   final Procedure abiSpecificIntegerArraySetElemAt;
   final Procedure asFunctionMethod;
@@ -630,11 +624,6 @@
         'StructPointer',
         '[]=',
       ),
-      structPointerElementAt = index.getProcedure(
-        'dart:ffi',
-        'StructPointer',
-        'elementAt',
-      ),
       structPointerPlusOperator = index.getProcedure(
         'dart:ffi',
         'StructPointer',
@@ -645,11 +634,6 @@
         'StructPointer',
         '-',
       ),
-      structPointerElementAtTearoff = index.getProcedure(
-        'dart:ffi',
-        'StructPointer',
-        LibraryIndex.tearoffPrefix + 'elementAt',
-      ),
       unionPointerGetRef = index.getProcedure(
         'dart:ffi',
         'UnionPointer',
@@ -680,11 +664,6 @@
         'UnionPointer',
         '[]=',
       ),
-      unionPointerElementAt = index.getProcedure(
-        'dart:ffi',
-        'UnionPointer',
-        'elementAt',
-      ),
       unionPointerPlusOperator = index.getProcedure(
         'dart:ffi',
         'UnionPointer',
@@ -695,11 +674,6 @@
         'UnionPointer',
         '-',
       ),
-      unionPointerElementAtTearoff = index.getProcedure(
-        'dart:ffi',
-        'UnionPointer',
-        LibraryIndex.tearoffPrefix + 'elementAt',
-      ),
       uint8PointerAsTypedList = index.getProcedure(
         'dart:ffi',
         'Uint8Pointer',
@@ -760,11 +734,6 @@
         'AbiSpecificIntegerPointer',
         '[]=',
       ),
-      abiSpecificIntegerPointerElementAt = index.getProcedure(
-        'dart:ffi',
-        'AbiSpecificIntegerPointer',
-        'elementAt',
-      ),
       abiSpecificIntegerPointerPlusOperator = index.getProcedure(
         'dart:ffi',
         'AbiSpecificIntegerPointer',
@@ -775,11 +744,6 @@
         'AbiSpecificIntegerPointer',
         '-',
       ),
-      abiSpecificIntegerPointerElementAtTearoff = index.getProcedure(
-        'dart:ffi',
-        'AbiSpecificIntegerPointer',
-        LibraryIndex.tearoffPrefix + 'elementAt',
-      ),
       abiSpecificIntegerArrayElemAt = index.getProcedure(
         'dart:ffi',
         'AbiSpecificIntegerArray',
diff --git a/pkg/vm/lib/modular/transformations/ffi/use_sites.dart b/pkg/vm/lib/modular/transformations/ffi/use_sites.dart
index 6d5fbbd..83f3627 100644
--- a/pkg/vm/lib/modular/transformations/ffi/use_sites.dart
+++ b/pkg/vm/lib/modular/transformations/ffi/use_sites.dart
@@ -221,10 +221,7 @@
             (node == allocationTearoff ||
                 node == asFunctionTearoff ||
                 node == lookupFunctionTearoff ||
-                node == abiSpecificIntegerPointerElementAtTearoff ||
-                node == structPointerElementAtTearoff ||
                 node == structPointerRefWithFinalizerTearoff ||
-                node == unionPointerElementAtTearoff ||
                 node == unionPointerRefWithFinalizerTearoff))) ||
         // Dart2wasm uses enabledConstructorTearOffLowerings but these are not
         // users trying to call constructors.
@@ -374,10 +371,7 @@
         ensureNativeTypeValid(nativeType, node, allowStructAndUnion: true);
 
         return _replaceRefWithFinalizer(node);
-      } else if (target == abiSpecificIntegerPointerElementAt ||
-          target == structPointerElementAt ||
-          target == unionPointerElementAt ||
-          target == abiSpecificIntegerPointerPlusOperator ||
+      } else if (target == abiSpecificIntegerPointerPlusOperator ||
           target == structPointerPlusOperator ||
           target == unionPointerPlusOperator ||
           target == abiSpecificIntegerPointerMinusOperator ||
diff --git a/runtime/tools/ffi/sdk_lib_ffi_generator.dart b/runtime/tools/ffi/sdk_lib_ffi_generator.dart
index e73d39c..31c37d0 100644
--- a/runtime/tools/ffi/sdk_lib_ffi_generator.dart
+++ b/runtime/tools/ffi/sdk_lib_ffi_generator.dart
@@ -245,10 +245,6 @@
   /// The $property at `address + sizeOf<$nativeType>() * index`.
 $platform$truncate$alignment  external void operator []=(int index, $dartType value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<$nativeType> elementAt(int index) => Pointer.fromAddress(address + sizeOf<$nativeType>() * index);
-
   /// A pointer to the [offset]th [$nativeType] after this one.
   ///
   /// Returns a pointer to the [$nativeType] whose address is
diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart
index f3b0f09..b7d6623 100644
--- a/sdk/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart
@@ -1434,10 +1434,6 @@
   Pointer<T> operator [](int index) => _loadPointer(this, _intPtrSize * index);
 
   @patch
-  Pointer<Pointer<T>> elementAt(int index) =>
-      Pointer.fromAddress(address + _intPtrSize * index);
-
-  @patch
   Pointer<Pointer<T>> operator +(int offset) =>
       Pointer.fromAddress(address + _intPtrSize * offset);
 
@@ -1475,10 +1471,6 @@
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
   @patch
-  Pointer<T> elementAt(int index) =>
-      throw "UNREACHABLE: This case should have been rewritten in the CFE.";
-
-  @patch
   Pointer<T> operator +(int offset) =>
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
@@ -1512,10 +1504,6 @@
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
   @patch
-  Pointer<T> elementAt(int index) =>
-      throw "UNREACHABLE: This case should have been rewritten in the CFE.";
-
-  @patch
   Pointer<T> operator +(int offset) =>
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
@@ -1544,10 +1532,6 @@
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
   @patch
-  Pointer<T> elementAt(int index) =>
-      throw "UNREACHABLE: This case should have been rewritten in the CFE.";
-
-  @patch
   Pointer<T> operator +(int offset) =>
       throw "UNREACHABLE: This case should have been rewritten in the CFE.";
 
diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart
index cd50033..2ca388b 100644
--- a/sdk/lib/ffi/ffi.dart
+++ b/sdk/lib/ffi/ffi.dart
@@ -519,11 +519,6 @@
   /// being stored, and the 8-bit value is sign-extended when it is loaded.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Int8> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Int8>() * index);
-
   /// A pointer to the [offset]th [Int8] after this one.
   ///
   /// Returns a pointer to the [Int8] whose address is
@@ -598,11 +593,6 @@
   /// The [address] must be 2-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Int16> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Int16>() * index);
-
   /// A pointer to the [offset]th [Int16] after this one.
   ///
   /// Returns a pointer to the [Int16] whose address is
@@ -679,11 +669,6 @@
   /// The [address] must be 4-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Int32> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Int32>() * index);
-
   /// A pointer to the [offset]th [Int32] after this one.
   ///
   /// Returns a pointer to the [Int32] whose address is
@@ -751,11 +736,6 @@
   /// The [address] must be 8-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Int64> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Int64>() * index);
-
   /// A pointer to the [offset]th [Int64] after this one.
   ///
   /// Returns a pointer to the [Int64] whose address is
@@ -826,11 +806,6 @@
   /// being stored, and the 8-bit value is zero-extended when it is loaded.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Uint8> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Uint8>() * index);
-
   /// A pointer to the [offset]th [Uint8] after this one.
   ///
   /// Returns a pointer to the [Uint8] whose address is
@@ -905,11 +880,6 @@
   /// The [address] must be 2-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Uint16> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Uint16>() * index);
-
   /// A pointer to the [offset]th [Uint16] after this one.
   ///
   /// Returns a pointer to the [Uint16] whose address is
@@ -986,11 +956,6 @@
   /// The [address] must be 4-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Uint32> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Uint32>() * index);
-
   /// A pointer to the [offset]th [Uint32] after this one.
   ///
   /// Returns a pointer to the [Uint32] whose address is
@@ -1058,11 +1023,6 @@
   /// The [address] must be 8-byte aligned.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Uint64> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Uint64>() * index);
-
   /// A pointer to the [offset]th [Uint64] after this one.
   ///
   /// Returns a pointer to the [Uint64] whose address is
@@ -1139,11 +1099,6 @@
   /// The [address] must be 4-byte aligned.
   external void operator []=(int index, double value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Float> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Float>() * index);
-
   /// A pointer to the [offset]th [Float] after this one.
   ///
   /// Returns a pointer to the [Float] whose address is
@@ -1211,11 +1166,6 @@
   /// The [address] must be 8-byte aligned.
   external void operator []=(int index, double value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Double> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Double>() * index);
-
   /// A pointer to the [offset]th [Double] after this one.
   ///
   /// Returns a pointer to the [Double] whose address is
@@ -1278,11 +1228,6 @@
   /// The bool at `address + sizeOf<Bool>() * index`.
   external void operator []=(int index, bool value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  Pointer<Bool> elementAt(int index) =>
-      Pointer.fromAddress(address + sizeOf<Bool>() * index);
-
   /// A pointer to the [offset]th [Bool] after this one.
   ///
   /// Returns a pointer to the [Bool] whose address is
@@ -1921,10 +1866,6 @@
   /// platforms the [address] must be 8-byte aligned.
   external void operator []=(int index, Pointer<T> value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  external Pointer<Pointer<T>> elementAt(int index);
-
   /// A pointer to the [offset]th [Pointer<T>] after this one.
   ///
   /// Returns a pointer to the [Pointer<T>] whose address is
@@ -2005,10 +1946,6 @@
   /// where `T` is a compile-time constant type.
   external void operator []=(int index, T value);
 
-  /// Pointer arithmetic (takes element size into account)
-  @Deprecated('Use operator + instead')
-  external Pointer<T> elementAt(int index);
-
   /// A pointer to the [offset]th [T] after this one.
   ///
   /// Returns a pointer to the [T] whose address is
@@ -2090,10 +2027,6 @@
   /// where `T` is a compile-time constant type.
   external void operator []=(int index, T value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  external Pointer<T> elementAt(int index);
-
   /// A pointer to the [offset]th [T] after this one.
   ///
   /// Returns a pointer to the [T] whose address is
@@ -2133,10 +2066,6 @@
   /// The integer at `address + sizeOf<T>() * index`.
   external void operator []=(int index, int value);
 
-  /// Pointer arithmetic (takes element size into account).
-  @Deprecated('Use operator + instead')
-  external Pointer<T> elementAt(int index);
-
   /// A pointer to the [offset]th [T] after this one.
   ///
   /// Returns a pointer to the [T] whose address is