source: src/CodeGen/Generate.cc@ 33218c6

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 33218c6 was 3268a58, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Some fixes after the header cleaning-tool

  • Property mode set to 100644
File size: 1.9 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Generate.cc --
8//
9// Author : Richard C. Bilson
10// Created On : Mon May 18 07:44:20 2015
11// Last Modified By : Andrew Beach
12// Last Modified On : Wed May 19 13:05:00 2017
13// Update Count : 6
14//
15#include "Generate.h"
16
17#include <iostream> // for ostream, endl, operator<<
18#include <list> // for list
19#include <string> // for operator<<
20
21#include "CodeGenerator.h" // for CodeGenerator, doSemicolon, oper...
22#include "GenType.h" // for genPrettyType
23#include "Parser/LinkageSpec.h" // for isBuiltin, isGeneratable
24#include "SynTree/BaseSyntaxNode.h" // for BaseSyntaxNode
25#include "SynTree/Declaration.h" // for Declaration
26#include "SynTree/Type.h" // for Type
27
28using namespace std;
29
30namespace CodeGen {
31 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks ) {
32 CodeGen::CodeGenerator cgv( os, pretty, generateC, lineMarks );
33 for ( auto & dcl : translationUnit ) {
34 if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
35 os << cgv.lineDirective(dcl);
36 dcl->accept(cgv);
37 if ( doSemicolon( dcl ) ) {
38 os << ";";
39 } // if
40 os << std::endl;
41 } // if
42 } // for
43 }
44
45 void generate( BaseSyntaxNode * node, std::ostream & os ) {
46 if ( Type * type = dynamic_cast< Type * >( node ) ) {
47 os << CodeGen::genPrettyType( type, "" );
48 } else {
49 CodeGen::CodeGenerator cgv( os, true, false, false );
50 node->accept( cgv );
51 }
52 os << std::endl;
53 }
54} // namespace CodeGen
55
56// Local Variables: //
57// tab-width: 4 //
58// mode: c++ //
59// compile-command: "make install" //
60// End: //
Note: See TracBrowser for help on using the repository browser.