source: src/SynTree/AggregateDecl.cc@ c84e80a

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox 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 c84e80a was 79970ed, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

implement warnings for missing struct member constructor calls, remove bad clones

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