[c468150] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
[c92bdcc] | 7 | // InitializerNode.hpp --
|
---|
[c468150] | 8 | //
|
---|
| 9 | // Author : Andrew Beach
|
---|
| 10 | // Created On : Wed Apr 5 11:31:00 2023
|
---|
| 11 | // Last Modified By : Andrew Beach
|
---|
| 12 | // Last Modified On : Wed Apr 5 11:48:00 2023
|
---|
| 13 | // Update Count : 0
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
[c92bdcc] | 18 | #include "ParseNode.hpp"
|
---|
[c468150] | 19 |
|
---|
[dc3fbe5] | 20 | struct InitializerNode final : public ParseList<InitializerNode> {
|
---|
[c468150] | 21 | InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode * des = nullptr );
|
---|
| 22 | InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr );
|
---|
| 23 | InitializerNode( bool isDelete );
|
---|
| 24 | ~InitializerNode();
|
---|
| 25 | virtual InitializerNode * clone() const { assert( false ); return nullptr; }
|
---|
| 26 |
|
---|
| 27 | ExpressionNode * get_expression() const { return expr; }
|
---|
| 28 |
|
---|
| 29 | InitializerNode * set_designators( ExpressionNode * des ) { designator = des; return this; }
|
---|
| 30 | ExpressionNode * get_designators() const { return designator; }
|
---|
| 31 |
|
---|
| 32 | InitializerNode * set_maybeConstructed( bool value ) { maybeConstructed = value; return this; }
|
---|
| 33 | bool get_maybeConstructed() const { return maybeConstructed; }
|
---|
| 34 |
|
---|
| 35 | bool get_isDelete() const { return isDelete; }
|
---|
| 36 |
|
---|
| 37 | InitializerNode * next_init() const { return kids; }
|
---|
| 38 |
|
---|
| 39 | void print( std::ostream & os, int indent = 0 ) const;
|
---|
| 40 | void printOneLine( std::ostream & ) const;
|
---|
| 41 |
|
---|
| 42 | virtual ast::Init * build() const;
|
---|
| 43 | private:
|
---|
| 44 | ExpressionNode * expr;
|
---|
| 45 | bool aggregate;
|
---|
| 46 | ExpressionNode * designator; // may be list
|
---|
| 47 | InitializerNode * kids;
|
---|
| 48 | bool maybeConstructed;
|
---|
| 49 | bool isDelete;
|
---|
| 50 | }; // InitializerNode
|
---|