source: translator/CodeGen/Generate.cc @ a0d9f94

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 a0d9f94 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 784 bytes
Line 
1#include <algorithm>
2#include <iostream>
3#include <cassert>
4#include <list>
5
6#include "Generate.h"
7#include "SynTree/Declaration.h"
8
9#include "CodeGenerator2.h"
10
11using namespace std;
12
13namespace CodeGen {
14
15  void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics ) {
16
17    CodeGen::CodeGenerator2 cgv( os );
18
19    for(std::list<Declaration *>::iterator i = translationUnit.begin(); i != translationUnit.end();  i++)
20      {
21        if( LinkageSpec::isGeneratable( (*i)->get_linkage() ) && (doIntrinsics || !LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) ) {
22          (*i)->accept(cgv);
23          cgv.shift_left();
24          if( doSemicolon( *i ) ) {
25            os << ";";
26          }
27          os << std::endl;
28        }
29      }
30
31  }
32
33} // namespace CodeGen
34
35
Note: See TracBrowser for help on using the repository browser.