Ignore:
Timestamp:
May 18, 2015, 11:20:23 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
51587aa
Parents:
a32b204
Message:

licencing: third groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/SynTree/NamedTypeDecl.cc

    ra32b204 r0dd3a2f  
     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 : Mon May 18 10:13:19 2015
     13// Update Count     : 1
     14//
     15
    116#include "Declaration.h"
    217#include "Type.h"
    318#include "utility.h"
    419
    5 
    620NamedTypeDecl::NamedTypeDecl( const std::string &name, StorageClass sc, Type *base )
    7     : Parent( name, sc, LinkageSpec::Cforall ), base( base )
    8 {}
     21        : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {}
    922
    1023NamedTypeDecl::NamedTypeDecl( const TypeDecl &other )
    11     : Parent( other ), base( maybeClone( other.base ) )
    12 {
    13     cloneAll( other.parameters, parameters );
    14     cloneAll( other.assertions, assertions );
     24        : Parent( other ), base( maybeClone( other.base ) ) {
     25        cloneAll( other.parameters, parameters );
     26        cloneAll( other.assertions, assertions );
    1527}
    1628
    1729NamedTypeDecl::~NamedTypeDecl() {
    18     delete base;
    19     deleteAll( parameters );
    20     deleteAll( assertions );
     30        delete base;
     31        deleteAll( parameters );
     32        deleteAll( assertions );
    2133}
    2234
    2335void NamedTypeDecl::print( std::ostream &os, int indent ) const {
    24     using namespace std;
    25    
    26     if ( get_name() != "" ) {
    27         os << get_name() << ": a ";
    28     } // if
    29     if ( get_storageClass() != NoStorageClass ) {
    30         os << storageClassName[ get_storageClass() ] << ' ';
    31     } // if
    32     os << typeString();
    33     if ( base ) {
    34         os << " for ";
    35         base->print( os, indent );
    36     } // if
    37     if ( ! parameters.empty() ) {
    38         os << endl << string( indent, ' ' ) << "with parameters" << endl;
    39         printAll( parameters, os, indent+2 );
    40     } // if
    41     if ( ! assertions.empty() ) {
    42         os << endl << string( indent, ' ' ) << "with assertions" << endl;
    43         printAll( assertions, os, indent+2 );
    44     } // if
     36        using namespace std;
     37       
     38        if ( get_name() != "" ) {
     39                os << get_name() << ": a ";
     40        } // if
     41        if ( get_storageClass() != NoStorageClass ) {
     42                os << storageClassName[ get_storageClass() ] << ' ';
     43        } // if
     44        os << typeString();
     45        if ( base ) {
     46                os << " for ";
     47                base->print( os, indent );
     48        } // if
     49        if ( ! parameters.empty() ) {
     50                os << endl << string( indent, ' ' ) << "with parameters" << endl;
     51                printAll( parameters, os, indent+2 );
     52        } // if
     53        if ( ! assertions.empty() ) {
     54                os << endl << string( indent, ' ' ) << "with assertions" << endl;
     55                printAll( assertions, os, indent+2 );
     56        } // if
    4557}
    4658
    4759void NamedTypeDecl::printShort( std::ostream &os, int indent ) const {
    48     using namespace std;
    49    
    50     if ( get_name() != "" ) {
    51         os << get_name() << ": a ";
    52     } // if
    53     if ( get_storageClass() != NoStorageClass ) {
    54         os << storageClassName[ get_storageClass() ] << ' ';
    55     } // if
    56     os << typeString();
    57     if ( base ) {
    58         os << " for ";
    59         base->print( os, indent );
    60     } // if
    61     if ( ! parameters.empty() ) {
    62         os << endl << string( indent, ' ' ) << "with parameters" << endl;
    63         printAll( parameters, os, indent+2 );
    64     } // if
     60        using namespace std;
     61       
     62        if ( get_name() != "" ) {
     63                os << get_name() << ": a ";
     64        } // if
     65        if ( get_storageClass() != NoStorageClass ) {
     66                os << storageClassName[ get_storageClass() ] << ' ';
     67        } // if
     68        os << typeString();
     69        if ( base ) {
     70                os << " for ";
     71                base->print( os, indent );
     72        } // if
     73        if ( ! parameters.empty() ) {
     74                os << endl << string( indent, ' ' ) << "with parameters" << endl;
     75                printAll( parameters, os, indent+2 );
     76        } // if
    6577}
    6678
    6779std::string TypedefDecl::typeString() const { return "typedef"; }
     80
     81// Local Variables: //
     82// tab-width: 4 //
     83// mode: c++ //
     84// compile-command: "make install" //
     85// End: //
Note: See TracChangeset for help on using the changeset viewer.