Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/FunctionDecl.cc

    rd3b7937 r7baed7d  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FunctionDecl.cc -- 
     7// FunctionDecl.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 13 18:11:44 2015
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Fri May 06 15:59:48 2016
    1313// Update Count     : 19
    1414//
     
    1919#include "Statement.h"
    2020#include "Type.h"
     21#include "Attribute.h"
    2122#include "Common/utility.h"
    2223
    23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn )
    24                 : Parent( name, sc, linkage ), type( type ), statements( statements ) {
     24FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
     25                : Parent( name, sc, linkage ), type( type ), statements( statements ), attributes( attributes ) {
    2526        set_isInline( isInline );
    2627        set_isNoreturn( isNoreturn );
     
    3334FunctionDecl::FunctionDecl( const FunctionDecl &other )
    3435        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     36                cloneAll( other.attributes, attributes );
    3537}
    3638
     
    3840        delete type;
    3941        delete statements;
     42        deleteAll( attributes );
    4043}
    4144
     
    5255        using std::endl;
    5356        using std::string;
    54        
     57
    5558        if ( get_name() != "" ) {
    5659                os << get_name() << ": ";
     
    6568                os << "_Noreturn ";
    6669        } // if
     70
     71        printAll( attributes, os, indent );
     72
    6773        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    6874                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     
    8793        if ( statements ) {
    8894                os << string( indent + 2, ' ' ) << "with body " << endl;
     95                os << string( indent + 4, ' ' );
    8996                statements->print( os, indent + 4 );
    9097        } // if
     
    94101        using std::endl;
    95102        using std::string;
    96        
     103
    97104        if ( get_name() != "" ) {
    98105                os << get_name() << ": ";
     
    104111                os << "_Noreturn ";
    105112        } // if
     113
     114        // xxx - should printShort print attributes?
     115
    106116        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    107117                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
Note: See TracChangeset for help on using the changeset viewer.