source: src/SynTree/AggregateDecl.cc@ 4d3ca1d8

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 4d3ca1d8 was 4040425, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

change keyword type to otype and context to trait

  • 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 : Wed Mar 2 17:28:00 2016
13// Update Count : 7
14//
15
16#include "Declaration.h"
17#include "Type.h"
18#include "Common/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 TraitDecl::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.