source: src/CodeGen/FixMain.h@ 36e6f10

Last change on this file since 36e6f10 was bef4f1a, checked in by Andrew Beach <ajbeach@…>, 2 years ago

Translation of the fix main pass to the new ast data structures.

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[13de47bc]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// FixMain.h --
8//
9// Author : Thierry Delisle
10// Created On : Thr Jan 12 14:11:09 2017
[f42fc13]11// Last Modified By : Andrew Beach
[8e48fca4]12// Last Modified On : Fri Oct 29 16:20:00 2021
13// Update Count : 8
[13de47bc]14//
15
[6b0b624]16#pragma once
[13de47bc]17
18#include <iosfwd>
19#include <memory>
[f42fc13]20#include <list>
[13de47bc]21
[8941b6b]22#include "AST/LinkageSpec.hpp"
[07de76b]23#include "SynTree/LinkageSpec.h"
[13de47bc]24
[f42fc13]25class Declaration;
[13de47bc]26class FunctionDecl;
[0c577f7]27namespace ast {
28 class FunctionDecl;
[bef4f1a]29 class TranslationUnit;
[0c577f7]30}
[13de47bc]31
32namespace CodeGen {
[0c577f7]33
[8e48fca4]34class FixMain {
35public :
36 static inline LinkageSpec::Spec mainLinkage() {
37 return replace_main ? LinkageSpec::Cforall : LinkageSpec::C;
38 }
[8941b6b]39 static inline ast::Linkage::Spec getMainLinkage() {
40 return replace_main ? ast::Linkage::Cforall : ast::Linkage::C;
41 }
[13de47bc]42
[8e48fca4]43 static inline void setReplaceMain(bool val) {
44 replace_main = val;
45 }
[13de47bc]46
[8e48fca4]47 static bool isMain(FunctionDecl* decl);
48 static bool isMain(const ast::FunctionDecl * decl);
[13de47bc]49
[8e48fca4]50 static void fix( std::list< Declaration * > & decls,
51 std::ostream &os, const char* bootloader_filename );
[bef4f1a]52 static void fix( ast::TranslationUnit & translationUnit,
53 std::ostream &os, const char * bootloader_filename );
[8e48fca4]54
55private:
56 static bool replace_main;
57};
[f42fc13]58
[60a8062]59} // namespace CodeGen
Note: See TracBrowser for help on using the repository browser.