================
@@ -8928,9 +8970,44 @@ class OMPInitClause final
   /// Returns true is interop-type 'targetsync' is used.
   bool getIsTargetSync() const { return IsTargetSync; }
 
+  /// Returns true if OMP 6.0 {fr/attr} syntax is used.
+  bool getHasPreferAttrs() const { return HasPreferAttrs; }
+
+  /// Number of pref-specs in prefer_type(...).
+  unsigned getNumPrefs() const { return varlist_size() - 1; }
+
+  /// Total attrs across all pref-specs.
+  unsigned getNumAttrs() const { return NumAttrs; }
+
+  /// All attr() exprs across every pref-spec, in pref-spec order (flat block).
+  ArrayRef<Expr *> getAttrs() const {
+    return ArrayRef<Expr *>(getTrailingObjects<Expr *>() + varlist_size(),
+                            NumAttrs);
+  }
+
+  /// Per-pref-spec attr end offsets: entry i is the inclusive cumulative attr
+  /// count through pref-spec i (one past its last attr in the flat attr 
block).
+  ArrayRef<unsigned> getAttrEnds() const {
+    return getTrailingObjects<unsigned>(getNumPrefs());
+  }
+
+  PrefView getPref(unsigned I) {
+    assert(I < getNumPrefs() && "pref-spec index out of range");
+    Expr **E = getTrailingObjects<Expr *>();
+    ArrayRef<unsigned> AttrEnds = getAttrEnds();
+    unsigned Start = (I == 0) ? 0 : AttrEnds[I - 1];
+    unsigned Count = AttrEnds[I] - Start;
+    return PrefView{E[1 + I],
+                    ArrayRef<Expr *>(E + varlist_size() + Start, Count)};
+  }
+  PrefView getPref(unsigned I) const {
+    return const_cast<OMPInitClause *>(this)->getPref(I);
+  }
----------------
ykhatav wrote:

In the current form it does not return attrs; may be i can modify it to return 
both

https://github.com/llvm/llvm-project/pull/198868
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to