source: translator/SynTree/AggregateDecl.cc @ 5c7fb6c

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 5c7fb6c was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[51b7345]1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: AggregateDecl.cc,v 1.7 2005/08/29 20:59:25 rcbilson Exp $
5 *
6 */
7
8#include "Declaration.h"
9#include "Type.h"
10#include "utility.h"
11
12
13AggregateDecl::AggregateDecl( const std::string &name )
14    : Parent( name, Declaration::NoStorageClass, LinkageSpec::Cforall )
15{
16}
17
18AggregateDecl::AggregateDecl( const AggregateDecl &other )
19    : Parent( other )
20{
21    cloneAll( other.members, members );
22    cloneAll( other.parameters, parameters );
23}
24
25AggregateDecl::~AggregateDecl()
26{
27    deleteAll( members );
28    deleteAll( parameters );
29}
30
31void 
32AggregateDecl::print( std::ostream &os, int indent ) const
33{
34    using std::string;
35    using std::endl;
36
37    os << typeString() << " " << get_name();
38    if( !parameters.empty() ) {
39        os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
40        printAll( parameters, os, indent+4 );
41    }
42    if( !members.empty() ) {
43        os << endl << string( indent+2, ' ' ) << "with members" << endl;
44        printAll( members, os, indent+4 );
45    }
46}
47
48void 
49AggregateDecl::printShort( std::ostream &os, int indent ) const
50{
51    using std::string;
52    using std::endl;
53
54    os << typeString() << " " << get_name();
55    if( !parameters.empty() ) {
56        os << endl << string( indent+2, ' ' ) << "with parameters" << endl;
57        printAll( parameters, os, indent+4 );
58    }
59}
60
61std::string StructDecl::typeString() const { return "struct"; }
62
63std::string UnionDecl::typeString() const { return "union"; }
64
65std::string EnumDecl::typeString() const { return "enum"; }
66
67std::string ContextDecl::typeString() const { return "context"; }
68
Note: See TracBrowser for help on using the repository browser.