Ignore:
Timestamp:
Nov 10, 2023, 5:04:30 PM (10 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
2174191
Parents:
f5ec35a
Message:

Took the special main linkage code out of FunctionDecl? and put it into a new pass. There is also a lot of related clean-up done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixMain.h

    rf5ec35a r61efa42  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixMain.h --
     7// FixMain.h -- Tools to change a Cforall main into a C main.
    88//
    99// Author           : Thierry Delisle
     
    1717
    1818#include <iosfwd>
    19 #include <memory>
    20 #include <list>
    21 
    22 #include "AST/LinkageSpec.hpp"
    2319
    2420namespace ast {
     
    2925namespace CodeGen {
    3026
    31 class FixMain {
    32 public :
    33         static inline ast::Linkage::Spec getMainLinkage() {
    34                 return replace_main ? ast::Linkage::Cforall : ast::Linkage::C;
    35         }
     27/// Is this function a program main function?
     28bool isMain( const ast::FunctionDecl * decl );
    3629
    37         static inline void setReplaceMain(bool val) {
    38                 replace_main = val;
    39         }
     30/// Adjust the linkage of main functions.
     31void fixMainLinkage( ast::TranslationUnit & transUnit, bool replaceMain );
    4032
    41         static bool isMain(const ast::FunctionDecl * decl);
    42 
    43         static void fix( ast::TranslationUnit & translationUnit,
    44                         std::ostream &os, const char * bootloader_filename );
    45 
    46 private:
    47         static bool replace_main;
    48 };
     33/// Add a wrapper around to run the Cforall main.
     34void fixMainInvoke( ast::TranslationUnit & transUnit,
     35                std::ostream & os, const char * bootloaderFilename );
    4936
    5037} // namespace CodeGen
Note: See TracChangeset for help on using the changeset viewer.