[clang] [NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach base-ptrs. (PR #155625)

Krzysztof Parzyszek via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 27 07:46:41 PDT 2025


================
@@ -6920,6 +7198,22 @@ class MappableExprsHandler {
   /// Map between lambda declarations and their map type.
   llvm::DenseMap<const ValueDecl *, const OMPMapClause *> LambdasMap;
 
+  /// Map from component lists to their attach pointer expressions.
+  mutable llvm::DenseMap<
+      OMPClauseMappableExprCommon::MappableExprComponentListRef, const Expr *>
+      AttachPtrExprMap;
+
+  /// Map from attach pointer expressions to their component depth.
+  /// nullptr key has std::nullopt depth. This can be used to order attach-ptr
+  /// expressions with increasing/decreasing depth.
+  /// The component-depth of `nullptr` (i.e. no attach-ptr) is `std::nullopt`.
+  /// TODO: Not urgent, but we should ideally use the number of pointer
+  /// dereferences in an expr as an indicator of its complexity, instead of the
+  /// component-depth. That would be needed for us to treat `p[1]`, `*(p + 10)`,
----------------
kparzysz wrote:

Should it be `p10` instead of `p[1]`?

https://github.com/llvm/llvm-project/pull/155625


More information about the cfe-commits mailing list