Skip to content

Commit 0911f65

Browse files
committed
[Frontend][OpenMP] Clarify requirements for ObjectT, NFC
Only the "id()" member function is required.
1 parent b5b61cc commit 0911f65

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

llvm/include/llvm/Frontend/OpenMP/ClauseT.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,32 +150,34 @@ template <typename T, typename... Ts> struct Union<T, Ts...> {
150150

151151
template <typename T> using ListT = llvm::SmallVector<T, 0>;
152152

153-
// The ObjectT class represents a variable (as defined in the OpenMP spec).
153+
// The ObjectT class represents a variable or a locator (as defined in
154+
// the OpenMP spec).
155+
// Note: the ObjectT template is not defined. Any user of it is expected to
156+
// provide their own specialization that conforms to the requirements listed
157+
// below.
158+
//
159+
// Let ObjectS be any specialization of ObjectT:
154160
//
155-
// A specialization of ObjectT<Id, Expr> must provide the following definitions:
161+
// ObjectS must provide the following definitions:
156162
// {
157163
// using IdTy = Id;
158164
// using ExprTy = Expr;
159165
//
160166
// auto id() const -> IdTy {
161-
// return the identifier of the object (for use in tests for
162-
// presence/absence of the object)
163-
// }
164-
//
165-
// auto ref() const -> (e.g. const ExprTy&) {
166-
// return the expression accessing (referencing) the object
167+
// // Return a value such that a.id() == b.id() if and only if:
168+
// // (1) both `a` and `b` represent the same variable or location, or
169+
// // (2) bool(a.id()) == false and bool(b.id()) == false
167170
// }
168171
// }
169172
//
170-
// For example, the ObjectT instance created for "var[x+1]" would have
171-
// the `id()` return the identifier for `var`, and the `ref()` return the
172-
// representation of the array-access `var[x+1]`.
173+
// The type IdTy should be hashable (usable as key in unordered containers).
173174
//
174-
// The identity of an object must always be present, i.e. it cannot be
175-
// nullptr, std::nullopt, etc. The reference is optional.
175+
// Values of type IdTy should be contextually convertible to `bool`.
176176
//
177-
// Note: the ObjectT template is not defined. Any user of it is expected to
178-
// provide their own specialization that conforms to the above requirements.
177+
// If S is an object of type ObjectS, then `bool(S.id())` is `false` if
178+
// and only if S does not represent any variable or location.
179+
//
180+
// ObjectS should be copyable, movable, and default-constructible.
179181
template <typename IdType, typename ExprType> struct ObjectT;
180182

181183
// By default, object equality is only determined by its identity.

0 commit comments

Comments
 (0)