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 ad17ba6a was
c8ffe20b,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
reformat files
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[51b7345] | 1 | #include <algorithm> |
---|
| 2 | |
---|
| 3 | #include "Type.h" |
---|
| 4 | #include "Declaration.h" |
---|
| 5 | #include "utility.h" |
---|
| 6 | |
---|
| 7 | |
---|
[c8ffe20b] | 8 | FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) { |
---|
[51b7345] | 9 | } |
---|
| 10 | |
---|
[c8ffe20b] | 11 | FunctionType::FunctionType( const FunctionType &other ) : Type( other ), isVarArgs( other.isVarArgs ) { |
---|
[51b7345] | 12 | cloneAll( other.returnVals, returnVals ); |
---|
| 13 | cloneAll( other.parameters, parameters ); |
---|
| 14 | } |
---|
| 15 | |
---|
[c8ffe20b] | 16 | FunctionType::~FunctionType() { |
---|
[51b7345] | 17 | deleteAll( returnVals ); |
---|
| 18 | deleteAll( parameters ); |
---|
| 19 | } |
---|
| 20 | |
---|
[c8ffe20b] | 21 | void FunctionType::print( std::ostream &os, int indent ) const { |
---|
[51b7345] | 22 | using std::string; |
---|
| 23 | using std::endl; |
---|
| 24 | |
---|
| 25 | Type::print( os, indent ); |
---|
| 26 | os << "function" << endl; |
---|
[c8ffe20b] | 27 | if ( ! parameters.empty() ) { |
---|
| 28 | os << string( indent + 2, ' ' ) << "with parameters" << endl; |
---|
| 29 | printAll( parameters, os, indent + 4 ); |
---|
| 30 | if ( isVarArgs ) { |
---|
| 31 | os << string( indent + 4, ' ' ) << "and a variable number of other arguments" << endl; |
---|
[51b7345] | 32 | } |
---|
[c8ffe20b] | 33 | } else if ( isVarArgs ) { |
---|
| 34 | os << string( indent + 4, ' ' ) << "accepting unspecified arguments" << endl; |
---|
[51b7345] | 35 | } |
---|
[c8ffe20b] | 36 | os << string( indent + 2, ' ' ) << "returning "; |
---|
| 37 | if ( returnVals.empty() ) { |
---|
| 38 | os << endl << string( indent + 4, ' ' ) << "nothing " << endl; |
---|
[51b7345] | 39 | } else { |
---|
| 40 | os << endl; |
---|
[c8ffe20b] | 41 | printAll( returnVals, os, indent + 4 ); |
---|
[51b7345] | 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.