source: src/SynTree/NamedTypeDecl.cc @ fc56cdbf

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since fc56cdbf was cbce272, checked in by Andrew Beach <ajbeach@…>, 7 years ago

Structure based exception handling.

  • Property mode set to 100644
File size: 2.2 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//
[46f6134]7// NamedTypeDecl.cc --
[0dd3a2f]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[cbce272]11// Last Modified By : Andrew Beach
12// Last Modified On : Wed Aug  9 13:28:00 2017
13// Update Count     : 14
[0dd3a2f]14//
15
[51b7345]16#include "Declaration.h"
17#include "Type.h"
[d3b7937]18#include "Common/utility.h"
[51b7345]19
[68fe077a]20NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base )
[a7c90d4]21        : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {}
[51b7345]22
[46f6134]23NamedTypeDecl::NamedTypeDecl( const NamedTypeDecl &other )
[0dd3a2f]24        : Parent( other ), base( maybeClone( other.base ) ) {
25        cloneAll( other.parameters, parameters );
26        cloneAll( other.assertions, assertions );
[51b7345]27}
28
[17cd4eb]29NamedTypeDecl::~NamedTypeDecl() {
[0dd3a2f]30        delete base;
31        deleteAll( parameters );
32        deleteAll( assertions );
[51b7345]33}
34
[17cd4eb]35void NamedTypeDecl::print( std::ostream &os, int indent ) const {
[0dd3a2f]36        using namespace std;
[46f6134]37
[0dd3a2f]38        if ( get_name() != "" ) {
[5f2f2d7]39                os << get_name() << ": ";
[0dd3a2f]40        } // if
[cbce272]41        if ( get_linkage() != LinkageSpec::Cforall ) {
42                os << LinkageSpec::linkageName( get_linkage() ) << " ";
43        } // if
[6e8bd43]44        get_storageClasses().print( os );
[0dd3a2f]45        os << typeString();
46        if ( base ) {
47                os << " for ";
48                base->print( os, indent );
49        } // if
50        if ( ! parameters.empty() ) {
51                os << endl << string( indent, ' ' ) << "with parameters" << endl;
52                printAll( parameters, os, indent+2 );
53        } // if
54        if ( ! assertions.empty() ) {
55                os << endl << string( indent, ' ' ) << "with assertions" << endl;
56                printAll( assertions, os, indent+2 );
57        } // if
[51b7345]58}
59
[17cd4eb]60void NamedTypeDecl::printShort( std::ostream &os, int indent ) const {
[0dd3a2f]61        using namespace std;
[46f6134]62
[0dd3a2f]63        if ( get_name() != "" ) {
[5f2f2d7]64                os << get_name() << ": ";
[0dd3a2f]65        } // if
[6e8bd43]66        get_storageClasses().print( os );
[0dd3a2f]67        os << typeString();
68        if ( base ) {
69                os << " for ";
70                base->print( os, indent );
71        } // if
72        if ( ! parameters.empty() ) {
73                os << endl << string( indent, ' ' ) << "with parameters" << endl;
74                printAll( parameters, os, indent+2 );
75        } // if
[51b7345]76}
77
78std::string TypedefDecl::typeString() const { return "typedef"; }
[0dd3a2f]79
80// Local Variables: //
81// tab-width: 4 //
82// mode: c++ //
83// compile-command: "make install" //
84// End: //
Note: See TracBrowser for help on using the repository browser.