mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
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:
committed by
Commit Bot service account
parent
688fe4477d
commit
52b06fb4c5
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user