ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 8c17ab0 was
51b7345,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[51b7345] | 1 | /* |
---|
| 2 | * This file is part of the Cforall project |
---|
| 3 | * |
---|
| 4 | * $Id: FunctionType.cc,v 1.8 2005/08/29 20:59:25 rcbilson Exp $ |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <algorithm> |
---|
| 9 | |
---|
| 10 | #include "Type.h" |
---|
| 11 | #include "Declaration.h" |
---|
| 12 | #include "utility.h" |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) |
---|
| 16 | : Type( tq ), isVarArgs( isVarArgs ) |
---|
| 17 | { |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | FunctionType::FunctionType( const FunctionType &other ) |
---|
| 21 | : Type( other ), isVarArgs( other.isVarArgs ) |
---|
| 22 | { |
---|
| 23 | cloneAll( other.returnVals, returnVals ); |
---|
| 24 | cloneAll( other.parameters, parameters ); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | FunctionType::~FunctionType() |
---|
| 28 | { |
---|
| 29 | deleteAll( returnVals ); |
---|
| 30 | deleteAll( parameters ); |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | void |
---|
| 34 | FunctionType::print( std::ostream &os, int indent ) const |
---|
| 35 | { |
---|
| 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 | } |
---|
| 47 | } else if( isVarArgs ) { |
---|
| 48 | os << string( indent+4, ' ' ) << "accepting unspecified arguments" << endl; |
---|
| 49 | } |
---|
| 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 | } |
---|
| 57 | |
---|
| 58 | } |
---|
| 59 | |
---|
Note: See
TracBrowser
for help on using the repository browser.