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