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