source: src/SynTree/AggregateDecl.cc @ b18b0b5

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since b18b0b5 was 68cd1ce, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

unify and fix storage class

  • Property mode set to 100644
File size: 1.9 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// AggregateDecl.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 23:56:39 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Jun 13 08:12:49 2015
13// Update Count     : 6
14//
15
16#include "Declaration.h"
17#include "Type.h"
18#include "utility.h"
19
20
21AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ) {
22}
23
24AggregateDecl::AggregateDecl( const AggregateDecl &other ) : Parent( other ) {
25        cloneAll( other.members, members );
26        cloneAll( other.parameters, parameters );
27}
28
29AggregateDecl::~AggregateDecl() {
30        deleteAll( members );
31        deleteAll( parameters );
32}
33
34void AggregateDecl::print( std::ostream &os, int indent ) const {
35        using std::string;
36        using std::endl;
37
38        os << typeString() << " " << get_name();
39        if ( ! parameters.empty() ) {
40                os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
41                printAll( parameters, os, indent+4 );
42        } // if
43        if ( ! members.empty() ) {
44                os << endl << string( indent+2, ' ' ) << "with members" << endl;
45                printAll( members, os, indent+4 );
46        } // if
47}
48
49void AggregateDecl::printShort( std::ostream &os, int indent ) const {
50        using std::string;
51        using std::endl;
52
53        os << typeString() << " " << get_name();
54        if ( ! parameters.empty() ) {
55                os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
56                printAll( parameters, os, indent+4 );
57        } // if
58}
59
60std::string StructDecl::typeString() const { return "struct"; }
61
62std::string UnionDecl::typeString() const { return "union"; }
63
64std::string EnumDecl::typeString() const { return "enum"; }
65
66std::string ContextDecl::typeString() const { return "context"; }
67
68// Local Variables: //
69// tab-width: 4 //
70// mode: c++ //
71// compile-command: "make install" //
72// End: //
Note: See TracBrowser for help on using the repository browser.