[0dd3a2f] | 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 | //
|
---|
[71f4e4f] | 7 | // Visitor.cc --
|
---|
[0dd3a2f] | 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
[6d49ea3] | 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Thu Aug 17 15:39:38 2017
|
---|
| 13 | // Update Count : 29
|
---|
[0dd3a2f] | 14 | //
|
---|
| 15 |
|
---|
[ea6332d] | 16 | #include <cassert> // for assert
|
---|
| 17 | #include <list> // for list
|
---|
| 18 |
|
---|
[5ea7a22] | 19 | #include "Attribute.h" // for Attribute
|
---|
[ea6332d] | 20 | #include "Constant.h" // for Constant
|
---|
| 21 | #include "Declaration.h" // for DeclarationWithType, ObjectDecl, Declaration
|
---|
| 22 | #include "Expression.h" // for Expression, ConstantExpr, ImplicitCopyCtorExpr
|
---|
| 23 | #include "Initializer.h" // for Initializer, Designation, ConstructorInit
|
---|
| 24 | #include "Statement.h" // for Statement, CatchStmt, AsmStmt, CompoundStmt
|
---|
| 25 | #include "Type.h" // for Type, Type::ForallList, AttrType, FunctionType
|
---|
[51b73452] | 26 | #include "Visitor.h"
|
---|
[ea6332d] | 27 |
|
---|
| 28 | class Subrange;
|
---|
[51b73452] | 29 |
|
---|
[d9a0e76] | 30 | Visitor::Visitor() {}
|
---|
[51b73452] | 31 |
|
---|
[d9a0e76] | 32 | Visitor::~Visitor() {}
|
---|
[51b73452] | 33 |
|
---|
[0dd3a2f] | 34 | void Visitor::visit( TupleType *tupleType ) {
|
---|
| 35 | acceptAll( tupleType->get_forall(), *this );
|
---|
| 36 | acceptAll( tupleType->get_types(), *this );
|
---|
[62423350] | 37 | acceptAll( tupleType->get_members(), *this );
|
---|
[51b73452] | 38 | }
|
---|
| 39 |
|
---|
[0dd3a2f] | 40 | void Visitor::visit( TypeofType *typeofType ) {
|
---|
| 41 | assert( typeofType->get_expr() );
|
---|
| 42 | typeofType->get_expr()->accept( *this );
|
---|
[51b73452] | 43 | }
|
---|
| 44 |
|
---|
[0dd3a2f] | 45 | void Visitor::visit( AttrType *attrType ) {
|
---|
| 46 | if ( attrType->get_isType() ) {
|
---|
| 47 | assert( attrType->get_type() );
|
---|
| 48 | attrType->get_type()->accept( *this );
|
---|
| 49 | } else {
|
---|
| 50 | assert( attrType->get_expr() );
|
---|
| 51 | attrType->get_expr()->accept( *this );
|
---|
| 52 | } // if
|
---|
[51b73452] | 53 | }
|
---|
| 54 |
|
---|
[44b7088] | 55 | void Visitor::visit( VarArgsType *varArgsType ) {
|
---|
| 56 | acceptAll( varArgsType->get_forall(), *this );
|
---|
| 57 | }
|
---|
| 58 |
|
---|
[89e6ffc] | 59 | void Visitor::visit( ZeroType *zeroType ) {
|
---|
| 60 | acceptAll( zeroType->get_forall(), *this );
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | void Visitor::visit( OneType *oneType ) {
|
---|
| 64 | acceptAll( oneType->get_forall(), *this );
|
---|
| 65 | }
|
---|
| 66 |
|
---|
[e4d829b] | 67 | void Visitor::visit( Designation * designation ) {
|
---|
| 68 | acceptAll( designation->get_designators(), *this );
|
---|
| 69 | }
|
---|
[e994912] | 70 |
|
---|
[0dd3a2f] | 71 | void Visitor::visit( SingleInit *singleInit ) {
|
---|
| 72 | singleInit->get_value()->accept( *this );
|
---|
[51b73452] | 73 | }
|
---|
| 74 |
|
---|
[0dd3a2f] | 75 | void Visitor::visit( ListInit *listInit ) {
|
---|
[e4d829b] | 76 | acceptAll( listInit->get_designations(), *this );
|
---|
[0dd3a2f] | 77 | acceptAll( listInit->get_initializers(), *this );
|
---|
[51b73452] | 78 | }
|
---|
| 79 |
|
---|
[71f4e4f] | 80 | void Visitor::visit( ConstructorInit *ctorInit ) {
|
---|
| 81 | maybeAccept( ctorInit->get_ctor(), *this );
|
---|
[d5556a3] | 82 | maybeAccept( ctorInit->get_dtor(), *this );
|
---|
[71f4e4f] | 83 | maybeAccept( ctorInit->get_init(), *this );
|
---|
| 84 | }
|
---|
| 85 |
|
---|
[e994912] | 86 |
|
---|
[5ea7a22] | 87 | void Visitor::visit( Subrange * ) {}
|
---|
[51b73452] | 88 |
|
---|
[e994912] | 89 |
|
---|
[5ea7a22] | 90 | void Visitor::visit( Constant * ) {}
|
---|
| 91 |
|
---|
| 92 | void Visitor::visit( Attribute * attribute ) {
|
---|
| 93 | acceptAll( attribute->parameters, *this );
|
---|
| 94 | }
|
---|
| 95 |
|
---|
[0dd3a2f] | 96 | // Local Variables: //
|
---|
| 97 | // tab-width: 4 //
|
---|
| 98 | // mode: c++ //
|
---|
| 99 | // compile-command: "make install" //
|
---|
| 100 | // End: //
|
---|