source: translator/SynTree/AggregateDecl.cc @ a08ba92

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 a08ba92 was a08ba92, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: sixth groups of files

  • Property mode set to 100644
File size: 1.9 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//
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
[a08ba92]12// Last Modified On : Tue May 19 16:52:08 2015
13// Update Count     : 5
[0dd3a2f]14//
[51b7345]15
16#include "Declaration.h"
17#include "Type.h"
18#include "utility.h"
19
20
[0dd3a2f]21AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, Declaration::NoStorageClass, LinkageSpec::Cforall ) {
[51b7345]22}
23
[0dd3a2f]24AggregateDecl::AggregateDecl( const AggregateDecl &other ) : Parent( other ) {
[a08ba92]25        cloneAll( other.members, members );
26        cloneAll( other.parameters, parameters );
[51b7345]27}
28
[0dd3a2f]29AggregateDecl::~AggregateDecl() {
[a08ba92]30        deleteAll( members );
31        deleteAll( parameters );
[51b7345]32}
33
[0dd3a2f]34void AggregateDecl::print( std::ostream &os, int indent ) const {
[a08ba92]35        using std::string;
36        using std::endl;
[51b7345]37
[a08ba92]38        os << typeString() << " " << get_name();
39        if ( ! parameters.empty() ) {
[0dd3a2f]40                os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
41                printAll( parameters, os, indent+4 );
[a08ba92]42        } // if
43        if ( ! members.empty() ) {
[0dd3a2f]44                os << endl << string( indent+2, ' ' ) << "with members" << endl;
45                printAll( members, os, indent+4 );
[a08ba92]46        } // if
[51b7345]47}
48
[0dd3a2f]49void AggregateDecl::printShort( std::ostream &os, int indent ) const {
[a08ba92]50        using std::string;
51        using std::endl;
[51b7345]52
[a08ba92]53        os << typeString() << " " << get_name();
54        if ( ! parameters.empty() ) {
[0dd3a2f]55                os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
56                printAll( parameters, os, indent+4 );
[a08ba92]57        } // if
[51b7345]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
[0dd3a2f]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.