ast: Add address-of and dereference unary ops

Nothing currently generates these.
Resolver currently doesn't know how to handle these.
Backends currently stubbed enough to build without warnings.

Bug: tint:727
Change-Id: I4b9863ae098b903b51a63c36c10bc6e390efbbb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50746
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-05-13 13:36:32 +00:00
committed by Commit Bot service account
parent 688fe4477d
commit 52b06fb4c5
9 changed files with 54 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ namespace ast {
/// A pointer type.
class Pointer : public Castable<Pointer, Type> {
public:
/// Construtor
/// Constructor
/// @param program_id the identifier of the program that owns this node
/// @param source the source of this node
/// @param subtype the pointee type

View File

@@ -19,6 +19,14 @@ namespace ast {
std::ostream& operator<<(std::ostream& out, UnaryOp mod) {
switch (mod) {
case UnaryOp::kAddressOf: {
out << "address-of";
break;
}
case UnaryOp::kDereference: {
out << "dereference";
break;
}
case UnaryOp::kNegation: {
out << "negation";
break;

View File

@@ -21,7 +21,12 @@ namespace tint {
namespace ast {
/// The unary op
enum class UnaryOp { kNegation = 0, kNot };
enum class UnaryOp {
kAddressOf, // &EXPR
kDereference, // *EXPR
kNegation, // -EXPR
kNot, // !EXPR
};
/// @param out the std::ostream to write to
/// @param mod the UnaryOp