source: src/SynTree/Visitor.cc@ 1f37ed02

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 1f37ed02 was cfaf9be, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

Make all Visitor/Mutator functions pure virtual, remove unused Visitor/Mutator code

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[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
28class Subrange;
[51b73452]29
[d9a0e76]30Visitor::Visitor() {}
[51b73452]31
[d9a0e76]32Visitor::~Visitor() {}
[51b73452]33
[0dd3a2f]34void 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]40void Visitor::visit( TypeofType *typeofType ) {
41 assert( typeofType->get_expr() );
42 typeofType->get_expr()->accept( *this );
[51b73452]43}
44
[0dd3a2f]45void 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]55void Visitor::visit( VarArgsType *varArgsType ) {
56 acceptAll( varArgsType->get_forall(), *this );
57}
58
[89e6ffc]59void Visitor::visit( ZeroType *zeroType ) {
60 acceptAll( zeroType->get_forall(), *this );
61}
62
63void Visitor::visit( OneType *oneType ) {
64 acceptAll( oneType->get_forall(), *this );
65}
66
[e4d829b]67void Visitor::visit( Designation * designation ) {
68 acceptAll( designation->get_designators(), *this );
69}
[e994912]70
[0dd3a2f]71void Visitor::visit( SingleInit *singleInit ) {
72 singleInit->get_value()->accept( *this );
[51b73452]73}
74
[0dd3a2f]75void Visitor::visit( ListInit *listInit ) {
[e4d829b]76 acceptAll( listInit->get_designations(), *this );
[0dd3a2f]77 acceptAll( listInit->get_initializers(), *this );
[51b73452]78}
79
[71f4e4f]80void 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]87void Visitor::visit( Subrange * ) {}
[51b73452]88
[e994912]89
[5ea7a22]90void Visitor::visit( Constant * ) {}
91
92void 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: //
Note: See TracBrowser for help on using the repository browser.