[llvm] 0911f65 - [Frontend][OpenMP] Clarify requirements for ObjectT, NFC

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 08:50:31 PDT 2024


Author: Krzysztof Parzyszek
Date: 2024-06-05T10:50:20-05:00
New Revision: 0911f6575fb0f9b487290ba28d1208c6b94716a0

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

LOG: [Frontend][OpenMP] Clarify requirements for ObjectT, NFC

Only the "id()" member function is required.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
index 5a3f8c605959a..a16673f82aa9c 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
@@ -150,32 +150,34 @@ template <typename T, typename... Ts> struct Union<T, Ts...> {
 
 template <typename T> using ListT = llvm::SmallVector<T, 0>;
 
-// The ObjectT class represents a variable (as defined in the OpenMP spec).
+// The ObjectT class represents a variable or a locator (as defined in
+// the OpenMP spec).
+// Note: the ObjectT template is not defined. Any user of it is expected to
+// provide their own specialization that conforms to the requirements listed
+// below.
+//
+// Let ObjectS be any specialization of ObjectT:
 //
-// A specialization of ObjectT<Id, Expr> must provide the following definitions:
+// ObjectS must provide the following definitions:
 // {
 //    using IdTy = Id;
 //    using ExprTy = Expr;
 //
 //    auto id() const -> IdTy {
-//      return the identifier of the object (for use in tests for
-//         presence/absence of the object)
-//    }
-//
-//    auto ref() const -> (e.g. const ExprTy&) {
-//      return the expression accessing (referencing) the object
+//      // Return a value such that a.id() == b.id() if and only if:
+//      // (1) both `a` and `b` represent the same variable or location, or
+//      // (2) bool(a.id()) == false and bool(b.id()) == false
 //    }
 // }
 //
-// For example, the ObjectT instance created for "var[x+1]" would have
-// the `id()` return the identifier for `var`, and the `ref()` return the
-// representation of the array-access `var[x+1]`.
+// The type IdTy should be hashable (usable as key in unordered containers).
 //
-// The identity of an object must always be present, i.e. it cannot be
-// nullptr, std::nullopt, etc. The reference is optional.
+// Values of type IdTy should be contextually convertible to `bool`.
 //
-// Note: the ObjectT template is not defined. Any user of it is expected to
-// provide their own specialization that conforms to the above requirements.
+// If S is an object of type ObjectS, then `bool(S.id())` is `false` if
+// and only if S does not represent any variable or location.
+//
+// ObjectS should be copyable, movable, and default-constructible.
 template <typename IdType, typename ExprType> struct ObjectT;
 
 // By default, object equality is only determined by its identity.


        


More information about the llvm-commits mailing list