source: translator/SynTree/FunctionType.cc@ 643a2e1

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since 643a2e1 was c8ffe20b, checked in by Peter A. Buhr <pabuhr@…>, 11 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
8FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) {
9}
10
11FunctionType::FunctionType( const FunctionType &other ) : Type( other ), isVarArgs( other.isVarArgs ) {
12 cloneAll( other.returnVals, returnVals );
13 cloneAll( other.parameters, parameters );
14}
15
16FunctionType::~FunctionType() {
17 deleteAll( returnVals );
18 deleteAll( parameters );
19}
20
21void 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.