source: src/SynTree/NamedTypeDecl.cc @ 796cea3

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 796cea3 was a7c90d4, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

change StorageClass? to bitset, support _Thread_local as separate storage-class

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