Rename RelationalExpression to BinaryExpression.

Match the more common usage for the expression type.

Bug: tint:37
Change-Id: Ia5d48a0444742ec4e304ea1036e499b3d7cad682
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18981
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/ast/binary_expression.cc b/src/ast/binary_expression.cc
new file mode 100644
index 0000000..115b41f
--- /dev/null
+++ b/src/ast/binary_expression.cc
@@ -0,0 +1,59 @@
+// Copyright 2020 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "src/ast/binary_expression.h"
+
+namespace tint {
+namespace ast {
+
+BinaryExpression::BinaryExpression() : Expression() {}
+
+BinaryExpression::BinaryExpression(BinaryOp op,
+                                   std::unique_ptr<Expression> lhs,
+                                   std::unique_ptr<Expression> rhs)
+    : Expression(), op_(op), lhs_(std::move(lhs)), rhs_(std::move(rhs)) {}
+
+BinaryExpression::BinaryExpression(const Source& source,
+                                   BinaryOp op,
+                                   std::unique_ptr<Expression> lhs,
+                                   std::unique_ptr<Expression> rhs)
+    : Expression(source), op_(op), lhs_(std::move(lhs)), rhs_(std::move(rhs)) {}
+
+BinaryExpression::~BinaryExpression() = default;
+
+bool BinaryExpression::IsValid() const {
+  if (lhs_ == nullptr || !lhs_->IsValid()) {
+    return false;
+  }
+  if (rhs_ == nullptr || !rhs_->IsValid()) {
+    return false;
+  }
+  return op_ != BinaryOp::kNone;
+}
+
+void BinaryExpression::to_str(std::ostream& out, size_t indent) const {
+  make_indent(out, indent);
+  out << "Binary{" << std::endl;
+  lhs_->to_str(out, indent + 2);
+
+  make_indent(out, indent + 2);
+  out << op_ << std::endl;
+
+  rhs_->to_str(out, indent + 2);
+  make_indent(out, indent);
+  out << "}" << std::endl;
+}
+
+}  // namespace ast
+}  // namespace tint
diff --git a/src/ast/binary_expression.h b/src/ast/binary_expression.h
new file mode 100644
index 0000000..0af2b6e
--- /dev/null
+++ b/src/ast/binary_expression.h
@@ -0,0 +1,221 @@
+// Copyright 2020 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SRC_AST_BINARY_EXPRESSION_H_
+#define SRC_AST_BINARY_EXPRESSION_H_
+
+#include <memory>
+#include <utility>
+
+#include "src/ast/expression.h"
+#include "src/ast/literal.h"
+
+namespace tint {
+namespace ast {
+
+/// The operator type
+enum class BinaryOp {
+  kNone = 0,
+  kAnd,
+  kOr,
+  kXor,
+  kLogicalAnd,
+  kLogicalOr,
+  kEqual,
+  kNotEqual,
+  kLessThan,
+  kGreaterThan,
+  kLessThanEqual,
+  kGreaterThanEqual,
+  kShiftLeft,
+  kShiftRight,
+  kShiftRightArith,
+  kAdd,
+  kSubtract,
+  kMultiply,
+  kDivide,
+  kModulo,
+};
+
+/// An binary expression
+class BinaryExpression : public Expression {
+ public:
+  /// Constructor
+  BinaryExpression();
+  /// Constructor
+  /// @param op the operation type
+  /// @param lhs the left side of the expression
+  /// @param rhs the right side of the expression
+  BinaryExpression(BinaryOp op,
+                   std::unique_ptr<Expression> lhs,
+                   std::unique_ptr<Expression> rhs);
+  /// Constructor
+  /// @param source the binary expression source
+  /// @param op the operation type
+  /// @param lhs the left side of the expression
+  /// @param rhs the right side of the expression
+  BinaryExpression(const Source& source,
+                   BinaryOp op,
+                   std::unique_ptr<Expression> lhs,
+                   std::unique_ptr<Expression> rhs);
+  /// Move constructor
+  BinaryExpression(BinaryExpression&&) = default;
+  ~BinaryExpression() override;
+
+  /// Sets the binary op type
+  /// @param op the binary op type
+  void set_op(BinaryOp op) { op_ = op; }
+  /// @returns the binary op type
+  BinaryOp op() const { return op_; }
+
+  /// @returns true if the op is and
+  bool IsAnd() const { return op_ == BinaryOp::kAnd; }
+  /// @returns true if the op is or
+  bool IsOr() const { return op_ == BinaryOp::kOr; }
+  /// @returns true if the op is xor
+  bool IsXor() const { return op_ == BinaryOp::kXor; }
+  /// @returns true if the op is logical and
+  bool IsLogicalAnd() const { return op_ == BinaryOp::kLogicalAnd; }
+  /// @returns true if the op is logical or
+  bool IsLogicalOr() const { return op_ == BinaryOp::kLogicalOr; }
+  /// @returns true if the op is equal
+  bool IsEqual() const { return op_ == BinaryOp::kEqual; }
+  /// @returns true if the op is not equal
+  bool IsNotEqual() const { return op_ == BinaryOp::kNotEqual; }
+  /// @returns true if the op is less than
+  bool IsLessThan() const { return op_ == BinaryOp::kLessThan; }
+  /// @returns true if the op is greater than
+  bool IsGreaterThan() const { return op_ == BinaryOp::kGreaterThan; }
+  /// @returns true if the op is less than equal
+  bool IsLessThanEqual() const { return op_ == BinaryOp::kLessThanEqual; }
+  /// @returns true if the op is greater than equal
+  bool IsGreaterThanEqual() const { return op_ == BinaryOp::kGreaterThanEqual; }
+  /// @returns true if the op is shift left
+  bool IsShiftLeft() const { return op_ == BinaryOp::kShiftLeft; }
+  /// @returns true if the op is shift right
+  bool IsShiftRight() const { return op_ == BinaryOp::kShiftRight; }
+  /// @returns true if the op is shift right arith
+  bool IsShiftRightArith() const { return op_ == BinaryOp::kShiftRightArith; }
+  /// @returns true if the op is add
+  bool IsAdd() const { return op_ == BinaryOp::kAdd; }
+  /// @returns true if the op is subtract
+  bool IsSubtract() const { return op_ == BinaryOp::kSubtract; }
+  /// @returns true if the op is multiply
+  bool IsMultiply() const { return op_ == BinaryOp::kMultiply; }
+  /// @returns true if the op is divide
+  bool IsDivide() const { return op_ == BinaryOp::kDivide; }
+  /// @returns true if the op is modulo
+  bool IsModulo() const { return op_ == BinaryOp::kModulo; }
+
+  /// Sets the left side of the expression
+  /// @param lhs the left side to set
+  void set_lhs(std::unique_ptr<Expression> lhs) { lhs_ = std::move(lhs); }
+  /// @returns the left side expression
+  Expression* lhs() const { return lhs_.get(); }
+
+  /// Sets the right side of the expression
+  /// @param rhs the right side to set
+  void set_rhs(std::unique_ptr<Expression> rhs) { rhs_ = std::move(rhs); }
+  /// @returns the right side expression
+  Expression* rhs() const { return rhs_.get(); }
+
+  /// @returns true if this is a op expression
+  bool IsBinary() const override { return true; }
+
+  /// @returns true if the node is valid
+  bool IsValid() const override;
+
+  /// Writes a representation of the node to the output stream
+  /// @param out the stream to write to
+  /// @param indent number of spaces to indent the node when writing
+  void to_str(std::ostream& out, size_t indent) const override;
+
+ private:
+  BinaryExpression(const BinaryExpression&) = delete;
+
+  BinaryOp op_ = BinaryOp::kNone;
+  std::unique_ptr<Expression> lhs_;
+  std::unique_ptr<Expression> rhs_;
+};
+
+inline std::ostream& operator<<(std::ostream& out, BinaryOp op) {
+  switch (op) {
+    case BinaryOp::kNone:
+      out << "none";
+      break;
+    case BinaryOp::kAnd:
+      out << "and";
+      break;
+    case BinaryOp::kOr:
+      out << "or";
+      break;
+    case BinaryOp::kXor:
+      out << "xor";
+      break;
+    case BinaryOp::kLogicalAnd:
+      out << "logical_and";
+      break;
+    case BinaryOp::kLogicalOr:
+      out << "logical_or";
+      break;
+    case BinaryOp::kEqual:
+      out << "equal";
+      break;
+    case BinaryOp::kNotEqual:
+      out << "not_equal";
+      break;
+    case BinaryOp::kLessThan:
+      out << "less_than";
+      break;
+    case BinaryOp::kGreaterThan:
+      out << "greater_than";
+      break;
+    case BinaryOp::kLessThanEqual:
+      out << "less_than_equal";
+      break;
+    case BinaryOp::kGreaterThanEqual:
+      out << "greater_than_equal";
+      break;
+    case BinaryOp::kShiftLeft:
+      out << "shift_left";
+      break;
+    case BinaryOp::kShiftRight:
+      out << "shift_right";
+      break;
+    case BinaryOp::kShiftRightArith:
+      out << "shift_right_arith";
+      break;
+    case BinaryOp::kAdd:
+      out << "add";
+      break;
+    case BinaryOp::kSubtract:
+      out << "subtract";
+      break;
+    case BinaryOp::kMultiply:
+      out << "multiply";
+      break;
+    case BinaryOp::kDivide:
+      out << "divide";
+      break;
+    case BinaryOp::kModulo:
+      out << "modulo";
+      break;
+  }
+  return out;
+}
+
+}  // namespace ast
+}  // namespace tint
+
+#endif  // SRC_AST_BINARY_EXPRESSION_H_
diff --git a/src/ast/relational_expression_test.cc b/src/ast/binary_expression_test.cc
similarity index 61%
rename from src/ast/relational_expression_test.cc
rename to src/ast/binary_expression_test.cc
index b014448..0ca73aa 100644
--- a/src/ast/relational_expression_test.cc
+++ b/src/ast/binary_expression_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "src/ast/relational_expression.h"
+#include "src/ast/binary_expression.h"
 
 #include <sstream>
 
@@ -23,95 +23,95 @@
 namespace ast {
 namespace {
 
-using RelationalExpressionTest = testing::Test;
+using BinaryExpressionTest = testing::Test;
 
-TEST_F(RelationalExpressionTest, Creation) {
+TEST_F(BinaryExpressionTest, Creation) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
   auto lhs_ptr = lhs.get();
   auto rhs_ptr = rhs.get();
 
-  RelationalExpression r(Relation::kEqual, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
   EXPECT_EQ(r.lhs(), lhs_ptr);
   EXPECT_EQ(r.rhs(), rhs_ptr);
-  EXPECT_EQ(r.relation(), Relation::kEqual);
+  EXPECT_EQ(r.op(), BinaryOp::kEqual);
 }
 
-TEST_F(RelationalExpressionTest, Creation_WithSource) {
+TEST_F(BinaryExpressionTest, Creation_WithSource) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r(Source{20, 2}, Relation::kEqual, std::move(lhs),
-                         std::move(rhs));
+  BinaryExpression r(Source{20, 2}, BinaryOp::kEqual, std::move(lhs),
+                     std::move(rhs));
   auto src = r.source();
   EXPECT_EQ(src.line, 20);
   EXPECT_EQ(src.column, 2);
 }
 
-TEST_F(RelationalExpressionTest, IsRelational) {
-  RelationalExpression r;
-  EXPECT_TRUE(r.IsRelational());
+TEST_F(BinaryExpressionTest, IsBinaryal) {
+  BinaryExpression r;
+  EXPECT_TRUE(r.IsBinary());
 }
 
-TEST_F(RelationalExpressionTest, IsValid) {
+TEST_F(BinaryExpressionTest, IsValid) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r(Relation::kEqual, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
   EXPECT_TRUE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, IsValid_Null_LHS) {
+TEST_F(BinaryExpressionTest, IsValid_Null_LHS) {
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r;
-  r.set_relation(Relation::kEqual);
+  BinaryExpression r;
+  r.set_op(BinaryOp::kEqual);
   r.set_rhs(std::move(rhs));
   EXPECT_FALSE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, IsValid_Invalid_LHS) {
+TEST_F(BinaryExpressionTest, IsValid_Invalid_LHS) {
   auto lhs = std::make_unique<IdentifierExpression>("");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r(Relation::kEqual, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
   EXPECT_FALSE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, IsValid_Null_RHS) {
+TEST_F(BinaryExpressionTest, IsValid_Null_RHS) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
 
-  RelationalExpression r;
-  r.set_relation(Relation::kEqual);
+  BinaryExpression r;
+  r.set_op(BinaryOp::kEqual);
   r.set_lhs(std::move(lhs));
   EXPECT_FALSE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, IsValid_Invalid_RHS) {
+TEST_F(BinaryExpressionTest, IsValid_Invalid_RHS) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("");
 
-  RelationalExpression r(Relation::kEqual, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
   EXPECT_FALSE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, IsValid_Relation_None) {
+TEST_F(BinaryExpressionTest, IsValid_Binary_None) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r(Relation::kNone, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kNone, std::move(lhs), std::move(rhs));
   EXPECT_FALSE(r.IsValid());
 }
 
-TEST_F(RelationalExpressionTest, ToStr) {
+TEST_F(BinaryExpressionTest, ToStr) {
   auto lhs = std::make_unique<IdentifierExpression>("lhs");
   auto rhs = std::make_unique<IdentifierExpression>("rhs");
 
-  RelationalExpression r(Relation::kEqual, std::move(lhs), std::move(rhs));
+  BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
   std::ostringstream out;
   r.to_str(out, 2);
-  EXPECT_EQ(out.str(), R"(  Relation{
+  EXPECT_EQ(out.str(), R"(  Binary{
     Identifier{lhs}
     equal
     Identifier{rhs}
diff --git a/src/ast/expression.cc b/src/ast/expression.cc
index 08e536e..6e34ef9 100644
--- a/src/ast/expression.cc
+++ b/src/ast/expression.cc
@@ -18,12 +18,12 @@
 
 #include "src/ast/array_accessor_expression.h"
 #include "src/ast/as_expression.h"
+#include "src/ast/binary_expression.h"
 #include "src/ast/call_expression.h"
 #include "src/ast/cast_expression.h"
 #include "src/ast/constructor_expression.h"
 #include "src/ast/identifier_expression.h"
 #include "src/ast/member_accessor_expression.h"
-#include "src/ast/relational_expression.h"
 #include "src/ast/unary_derivative_expression.h"
 #include "src/ast/unary_method_expression.h"
 #include "src/ast/unary_op_expression.h"
@@ -47,6 +47,11 @@
   return static_cast<AsExpression*>(this);
 }
 
+BinaryExpression* Expression::AsBinary() {
+  assert(IsBinary());
+  return static_cast<BinaryExpression*>(this);
+}
+
 CallExpression* Expression::AsCall() {
   assert(IsCall());
   return static_cast<CallExpression*>(this);
@@ -57,26 +62,21 @@
   return static_cast<CastExpression*>(this);
 }
 
-IdentifierExpression* Expression::AsIdentifier() {
-  assert(IsIdentifier());
-  return static_cast<IdentifierExpression*>(this);
-}
-
 ConstructorExpression* Expression::AsConstructor() {
   assert(IsConstructor());
   return static_cast<ConstructorExpression*>(this);
 }
 
+IdentifierExpression* Expression::AsIdentifier() {
+  assert(IsIdentifier());
+  return static_cast<IdentifierExpression*>(this);
+}
+
 MemberAccessorExpression* Expression::AsMemberAccessor() {
   assert(IsMemberAccessor());
   return static_cast<MemberAccessorExpression*>(this);
 }
 
-RelationalExpression* Expression::AsRelational() {
-  assert(IsRelational());
-  return static_cast<RelationalExpression*>(this);
-}
-
 UnaryDerivativeExpression* Expression::AsUnaryDerivative() {
   assert(IsUnaryDerivative());
   return static_cast<UnaryDerivativeExpression*>(this);
diff --git a/src/ast/expression.h b/src/ast/expression.h
index 065755f..abd7661 100644
--- a/src/ast/expression.h
+++ b/src/ast/expression.h
@@ -26,12 +26,12 @@
 
 class ArrayAccessorExpression;
 class AsExpression;
+class BinaryExpression;
 class CallExpression;
 class CastExpression;
 class IdentifierExpression;
 class ConstructorExpression;
 class MemberAccessorExpression;
-class RelationalExpression;
 class UnaryDerivativeExpression;
 class UnaryMethodExpression;
 class UnaryOpExpression;
@@ -61,8 +61,8 @@
   virtual bool IsConstructor() const { return false; }
   /// @returns true if this is a member accessor expression
   virtual bool IsMemberAccessor() const { return false; }
-  /// @returns true if this is a relational expression
-  virtual bool IsRelational() const { return false; }
+  /// @returns true if this is a binary expression
+  virtual bool IsBinary() const { return false; }
   /// @returns true if this is a unary derivative expression
   virtual bool IsUnaryDerivative() const { return false; }
   /// @returns true if this is a unary method expression
@@ -84,8 +84,8 @@
   ConstructorExpression* AsConstructor();
   /// @returns the expression as a member accessor
   MemberAccessorExpression* AsMemberAccessor();
-  /// @returns the expression as a relational expression
-  RelationalExpression* AsRelational();
+  /// @returns the expression as a binary expression
+  BinaryExpression* AsBinary();
   /// @returns the expression as a unary derivative expression
   UnaryDerivativeExpression* AsUnaryDerivative();
   /// @returns the expression as a unary method expression
diff --git a/src/ast/relational_expression.cc b/src/ast/relational_expression.cc
deleted file mode 100644
index a5e3863..0000000
--- a/src/ast/relational_expression.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/ast/relational_expression.h"
-
-namespace tint {
-namespace ast {
-
-RelationalExpression::RelationalExpression() : Expression() {}
-
-RelationalExpression::RelationalExpression(Relation relation,
-                                           std::unique_ptr<Expression> lhs,
-                                           std::unique_ptr<Expression> rhs)
-    : Expression(),
-      relation_(relation),
-      lhs_(std::move(lhs)),
-      rhs_(std::move(rhs)) {}
-
-RelationalExpression::RelationalExpression(const Source& source,
-                                           Relation relation,
-                                           std::unique_ptr<Expression> lhs,
-                                           std::unique_ptr<Expression> rhs)
-    : Expression(source),
-      relation_(relation),
-      lhs_(std::move(lhs)),
-      rhs_(std::move(rhs)) {}
-
-RelationalExpression::~RelationalExpression() = default;
-
-bool RelationalExpression::IsValid() const {
-  if (lhs_ == nullptr || !lhs_->IsValid()) {
-    return false;
-  }
-  if (rhs_ == nullptr || !rhs_->IsValid()) {
-    return false;
-  }
-  return relation_ != Relation::kNone;
-}
-
-void RelationalExpression::to_str(std::ostream& out, size_t indent) const {
-  make_indent(out, indent);
-  out << "Relation{" << std::endl;
-  lhs_->to_str(out, indent + 2);
-
-  make_indent(out, indent + 2);
-  out << relation_ << std::endl;
-
-  rhs_->to_str(out, indent + 2);
-  make_indent(out, indent);
-  out << "}" << std::endl;
-}
-
-}  // namespace ast
-}  // namespace tint
diff --git a/src/ast/relational_expression.h b/src/ast/relational_expression.h
deleted file mode 100644
index f5bd944..0000000
--- a/src/ast/relational_expression.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef SRC_AST_RELATIONAL_EXPRESSION_H_
-#define SRC_AST_RELATIONAL_EXPRESSION_H_
-
-#include <memory>
-#include <utility>
-
-#include "src/ast/expression.h"
-#include "src/ast/literal.h"
-
-namespace tint {
-namespace ast {
-
-/// The relation type
-enum class Relation {
-  kNone = 0,
-  kAnd,
-  kOr,
-  kXor,
-  kLogicalAnd,
-  kLogicalOr,
-  kEqual,
-  kNotEqual,
-  kLessThan,
-  kGreaterThan,
-  kLessThanEqual,
-  kGreaterThanEqual,
-  kShiftLeft,
-  kShiftRight,
-  kShiftRightArith,
-  kAdd,
-  kSubtract,
-  kMultiply,
-  kDivide,
-  kModulo,
-};
-
-/// An xor expression
-class RelationalExpression : public Expression {
- public:
-  /// Constructor
-  RelationalExpression();
-  /// Constructor
-  /// @param relation the relation type
-  /// @param lhs the left side of the expression
-  /// @param rhs the right side of the expression
-  RelationalExpression(Relation relation,
-                       std::unique_ptr<Expression> lhs,
-                       std::unique_ptr<Expression> rhs);
-  /// Constructor
-  /// @param source the relational expression source
-  /// @param relation the relation type
-  /// @param lhs the left side of the expression
-  /// @param rhs the right side of the expression
-  RelationalExpression(const Source& source,
-                       Relation relation,
-                       std::unique_ptr<Expression> lhs,
-                       std::unique_ptr<Expression> rhs);
-  /// Move constructor
-  RelationalExpression(RelationalExpression&&) = default;
-  ~RelationalExpression() override;
-
-  /// Sets the relation type
-  /// @param relation the relation type
-  void set_relation(Relation relation) { relation_ = relation; }
-  /// @returns the relation
-  Relation relation() const { return relation_; }
-
-  /// @returns true if the relation is and
-  bool IsAnd() const { return relation_ == Relation::kAnd; }
-  /// @returns true if the relation is or
-  bool IsOr() const { return relation_ == Relation::kOr; }
-  /// @returns true if the relation is xor
-  bool IsXor() const { return relation_ == Relation::kXor; }
-  /// @returns true if the relation is logical and
-  bool IsLogicalAnd() const { return relation_ == Relation::kLogicalAnd; }
-  /// @returns true if the relation is logical or
-  bool IsLogicalOr() const { return relation_ == Relation::kLogicalOr; }
-  /// @returns true if the relation is equal
-  bool IsEqual() const { return relation_ == Relation::kEqual; }
-  /// @returns true if the relation is not equal
-  bool IsNotEqual() const { return relation_ == Relation::kNotEqual; }
-  /// @returns true if the relation is less than
-  bool IsLessThan() const { return relation_ == Relation::kLessThan; }
-  /// @returns true if the relation is greater than
-  bool IsGreaterThan() const { return relation_ == Relation::kGreaterThan; }
-  /// @returns true if the relation is less than equal
-  bool IsLessThanEqual() const { return relation_ == Relation::kLessThanEqual; }
-  /// @returns true if the relation is greater than equal
-  bool IsGreaterThanEqual() const {
-    return relation_ == Relation::kGreaterThanEqual;
-  }
-  /// @returns true if the relation is shift left
-  bool IsShiftLeft() const { return relation_ == Relation::kShiftLeft; }
-  /// @returns true if the relation is shift right
-  bool IsShiftRight() const { return relation_ == Relation::kShiftRight; }
-  /// @returns true if the relation is shift right arith
-  bool IsShiftRightArith() const {
-    return relation_ == Relation::kShiftRightArith;
-  }
-  /// @returns true if the relation is add
-  bool IsAdd() const { return relation_ == Relation::kAdd; }
-  /// @returns true if the relation is subtract
-  bool IsSubtract() const { return relation_ == Relation::kSubtract; }
-  /// @returns true if the relation is multiply
-  bool IsMultiply() const { return relation_ == Relation::kMultiply; }
-  /// @returns true if the relation is divide
-  bool IsDivide() const { return relation_ == Relation::kDivide; }
-  /// @returns true if the relation is modulo
-  bool IsModulo() const { return relation_ == Relation::kModulo; }
-
-  /// Sets the left side of the expression
-  /// @param lhs the left side to set
-  void set_lhs(std::unique_ptr<Expression> lhs) { lhs_ = std::move(lhs); }
-  /// @returns the left side expression
-  Expression* lhs() const { return lhs_.get(); }
-
-  /// Sets the right side of the expression
-  /// @param rhs the right side to set
-  void set_rhs(std::unique_ptr<Expression> rhs) { rhs_ = std::move(rhs); }
-  /// @returns the right side expression
-  Expression* rhs() const { return rhs_.get(); }
-
-  /// @returns true if this is a relational expression
-  bool IsRelational() const override { return true; }
-
-  /// @returns true if the node is valid
-  bool IsValid() const override;
-
-  /// Writes a representation of the node to the output stream
-  /// @param out the stream to write to
-  /// @param indent number of spaces to indent the node when writing
-  void to_str(std::ostream& out, size_t indent) const override;
-
- private:
-  RelationalExpression(const RelationalExpression&) = delete;
-
-  Relation relation_ = Relation::kNone;
-  std::unique_ptr<Expression> lhs_;
-  std::unique_ptr<Expression> rhs_;
-};
-
-inline std::ostream& operator<<(std::ostream& out, Relation relation) {
-  switch (relation) {
-    case Relation::kNone:
-      out << "none";
-      break;
-    case Relation::kAnd:
-      out << "and";
-      break;
-    case Relation::kOr:
-      out << "or";
-      break;
-    case Relation::kXor:
-      out << "xor";
-      break;
-    case Relation::kLogicalAnd:
-      out << "logical_and";
-      break;
-    case Relation::kLogicalOr:
-      out << "logical_or";
-      break;
-    case Relation::kEqual:
-      out << "equal";
-      break;
-    case Relation::kNotEqual:
-      out << "not_equal";
-      break;
-    case Relation::kLessThan:
-      out << "less_than";
-      break;
-    case Relation::kGreaterThan:
-      out << "greater_than";
-      break;
-    case Relation::kLessThanEqual:
-      out << "less_than_equal";
-      break;
-    case Relation::kGreaterThanEqual:
-      out << "greater_than_equal";
-      break;
-    case Relation::kShiftLeft:
-      out << "shift_left";
-      break;
-    case Relation::kShiftRight:
-      out << "shift_right";
-      break;
-    case Relation::kShiftRightArith:
-      out << "shift_right_arith";
-      break;
-    case Relation::kAdd:
-      out << "add";
-      break;
-    case Relation::kSubtract:
-      out << "subtract";
-      break;
-    case Relation::kMultiply:
-      out << "multiply";
-      break;
-    case Relation::kDivide:
-      out << "divide";
-      break;
-    case Relation::kModulo:
-      out << "modulo";
-      break;
-  }
-  return out;
-}
-
-}  // namespace ast
-}  // namespace tint
-
-#endif  // SRC_AST_RELATIONAL_EXPRESSION_H_