source: src/CodeGen/Generate.cc @ d94195d

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since d94195d was bf2438c, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Cleaned-up some headers using a tool called 'include-what-you-use'

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[51587aa]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//
[35b1bf4]7// Generate.cc --
[51587aa]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[c850687]11// Last Modified By : Andrew Beach
12// Last Modified On : Wed May 19 13:05:00 2017
13// Update Count     : 6
[51587aa]14//
15
[bf2438c]16#include <iostream>                  // for ostream, endl, operator<<
17#include <list>                      // for list
18#include <string>                    // for operator<<
[51b7345]19
[bf2438c]20#include "CodeGenerator.h"           // for CodeGenerator, doSemicolon, oper...
21#include "GenType.h"                 // for genPrettyType
[51b7345]22#include "Generate.h"
[bf2438c]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
[51b7345]27
28using namespace std;
29
30namespace CodeGen {
[c850687]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 );
[e6512c8]33                for ( auto & dcl : translationUnit ) {
34                        if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
[c850687]35                                os << cgv.lineDirective(dcl);
[e6512c8]36                                dcl->accept(cgv);
37                                if ( doSemicolon( dcl ) ) {
[51587aa]38                                        os << ";";
39                                } // if
40                                os << std::endl;
41                        } // if
42                } // for
43        }
[262f085f]44
45        void generate( BaseSyntaxNode * node, std::ostream & os ) {
46                if ( Type * type = dynamic_cast< Type * >( node ) ) {
47                        os << CodeGen::genPrettyType( type, "" );
48                } else {
[c850687]49                        CodeGen::CodeGenerator cgv( os, true, false, false );
[262f085f]50                        node->accept( cgv );
51                }
52                os << std::endl;
53        }
[51b7345]54} // namespace CodeGen
[51587aa]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.