summaryrefslogtreecommitdiff
path: root/src/ir/possible-contents.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/possible-contents.h')
-rw-r--r--src/ir/possible-contents.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ir/possible-contents.h b/src/ir/possible-contents.h
index cf92a578a..b7c9bfafd 100644
--- a/src/ir/possible-contents.h
+++ b/src/ir/possible-contents.h
@@ -103,12 +103,12 @@ class PossibleContents {
// full cone of all subtypes for that type.
static ConeType FullConeType(Type type) { return ConeType{type, FullDepth}; }
+ template<typename T> PossibleContents(T value) : value(value) {}
+
public:
PossibleContents() : value(None()) {}
PossibleContents(const PossibleContents& other) = default;
- template<typename T> explicit PossibleContents(T val) : value(val) {}
-
// Most users will use one of the following static functions to construct a
// new instance:
@@ -163,7 +163,12 @@ public:
// Combine the information in a given PossibleContents to this one. The
// contents here will then include whatever content was possible in |other|.
- void combine(const PossibleContents& other);
+ [[nodiscard]] static PossibleContents combine(const PossibleContents& a,
+ const PossibleContents& b);
+
+ void combine(const PossibleContents& other) {
+ *this = PossibleContents::combine(*this, other);
+ }
// Removes anything not in |other| from this object, so that it ends up with
// only their intersection. Currently this only handles an intersection with a