source: src/SynTree/Visitor.cc @ 4b1be68

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 4b1be68 was cfaf9be, checked in by Rob Schluntz <rschlunt@…>, 6 years ago

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

  • Property mode set to 100644
File size: 2.7 KB
Line 
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//
7// Visitor.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Aug 17 15:39:38 2017
13// Update Count     : 29
14//
15
16#include <cassert>        // for assert
17#include <list>           // for list
18
19#include "Attribute.h"    // for Attribute
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
26#include "Visitor.h"
27
28class Subrange;
29
30Visitor::Visitor() {}
31
32Visitor::~Visitor() {}
33
34void Visitor::visit( TupleType *tupleType ) {
35        acceptAll( tupleType->get_forall(), *this );
36        acceptAll( tupleType->get_types(), *this );
37        acceptAll( tupleType->get_members(), *this );
38}
39
40void Visitor::visit( TypeofType *typeofType ) {
41        assert( typeofType->get_expr() );
42        typeofType->get_expr()->accept( *this );
43}
44
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
53}
54
55void Visitor::visit( VarArgsType *varArgsType ) {
56        acceptAll( varArgsType->get_forall(), *this );
57}
58
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
67void Visitor::visit( Designation * designation ) {
68        acceptAll( designation->get_designators(), *this );
69}
70
71void Visitor::visit( SingleInit *singleInit ) {
72        singleInit->get_value()->accept( *this );
73}
74
75void Visitor::visit( ListInit *listInit ) {
76        acceptAll( listInit->get_designations(), *this );
77        acceptAll( listInit->get_initializers(), *this );
78}
79
80void Visitor::visit( ConstructorInit *ctorInit ) {
81        maybeAccept( ctorInit->get_ctor(), *this );
82        maybeAccept( ctorInit->get_dtor(), *this );
83        maybeAccept( ctorInit->get_init(), *this );
84}
85
86
87void Visitor::visit( Subrange * ) {}
88
89
90void Visitor::visit( Constant * ) {}
91
92void Visitor::visit( Attribute * attribute ) {
93        acceptAll( attribute->parameters, *this );
94}
95
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.