source: src/SynTree/FunctionType.cc @ 45576af9

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 45576af9 was d3b7937, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

building runtime library (first attempt)

  • Property mode set to 100644
File size: 1.7 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// FunctionType.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 09:01:28 2015
13// Update Count     : 1
14//
15
16#include <algorithm>
17
18#include "Type.h"
19#include "Declaration.h"
20#include "Common/utility.h"
21
22FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) {
23}
24
25FunctionType::FunctionType( const FunctionType &other ) : Type( other ), isVarArgs( other.isVarArgs ) {
26        cloneAll( other.returnVals, returnVals );
27        cloneAll( other.parameters, parameters );
28}
29
30FunctionType::~FunctionType() {
31        deleteAll( returnVals );
32        deleteAll( parameters );
33}
34
35void FunctionType::print( std::ostream &os, int indent ) const {
36        using std::string;
37        using std::endl;
38
39        Type::print( os, indent );
40        os << "function" << endl;
41        if ( ! parameters.empty() ) {
42                os << string( indent + 2, ' ' ) << "with parameters" << endl;
43                printAll( parameters, os, indent + 4 );
44                if ( isVarArgs ) {
45                        os << string( indent + 4, ' ' ) << "and a variable number of other arguments" << endl;
46                } // if
47        } else if ( isVarArgs ) {
48                os << string( indent + 4, ' ' ) << "accepting unspecified arguments" << endl;
49        } // if
50        os << string( indent + 2, ' ' ) << "returning ";
51        if ( returnVals.empty() ) {
52                os << endl << string( indent + 4, ' ' ) << "nothing " << endl;
53        } else {
54                os << endl;
55                printAll( returnVals, os, indent + 4 );
56        } // if
57}
58
59// Local Variables: //
60// tab-width: 4 //
61// mode: c++ //
62// compile-command: "make install" //
63// End: //
Note: See TracBrowser for help on using the repository browser.