source: src/SynTree/AggregateDecl.cc @ 273080f

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

change keyword type to otype and context to trait

  • 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
[4040425]12// Last Modified On : Wed Mar  2 17:28:00 2016
13// Update Count     : 7
[0dd3a2f]14//
[51b7345]15
16#include "Declaration.h"
17#include "Type.h"
[d3b7937]18#include "Common/utility.h"
[51b7345]19
20
[68cd1ce]21AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::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
[4040425]66std::string TraitDecl::typeString() const { return "context"; }
[51b7345]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.