Changeset 8d7bef2 for src/CodeGen
- Timestamp:
- Mar 20, 2018, 5:12:25 PM (7 years ago)
- Branches:
- new-env, with_gc
- Children:
- 7e4b44db
- Parents:
- 68f9c43
- Location:
- src/CodeGen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixMain.cc
r68f9c43 r8d7bef2 29 29 namespace CodeGen { 30 30 bool FixMain::replace_main = false; 31 std::unique_ptr<FunctionDecl>FixMain::main_signature = nullptr;31 FunctionDecl* FixMain::main_signature = nullptr; 32 32 33 33 template<typename container> … … 41 41 SemanticError(functionDecl, "Multiple definition of main routine\n"); 42 42 } 43 main_signature .reset( functionDecl->clone() );43 main_signature = functionDecl; 44 44 } 45 45 -
src/CodeGen/FixMain.h
r68f9c43 r8d7bef2 40 40 private: 41 41 static bool replace_main; 42 static std::unique_ptr<FunctionDecl>main_signature;42 static FunctionDecl* main_signature; 43 43 }; 44 44 }; -
src/CodeGen/FixNames.cc
r68f9c43 r8d7bef2 16 16 #include "FixNames.h" 17 17 18 #include <memory> // for unique_ptr19 18 #include <string> // for string, operator!=, operator== 20 19 … … 47 46 std::string mangle_main() { 48 47 FunctionType* main_type; 49 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,50 main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )51 48 FunctionDecl* mainDecl = new FunctionDecl{ 49 "main", Type::StorageClasses(), LinkageSpec::Cforall, 50 main_type = new FunctionType{ Type::Qualifiers(), true }, nullptr }; 52 51 main_type->get_returnVals().push_back( 53 52 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) 54 53 ); 55 54 56 auto && name = SymTab::Mangler::mangle( mainDecl .get());55 auto && name = SymTab::Mangler::mangle( mainDecl ); 57 56 // std::cerr << name << std::endl; 58 57 return name; … … 60 59 std::string mangle_main_args() { 61 60 FunctionType* main_type; 62 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,63 main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )64 61 FunctionDecl* mainDecl = new FunctionDecl{ 62 "main", Type::StorageClasses(), LinkageSpec::Cforall, 63 main_type = new FunctionType{ Type::Qualifiers(), false }, nullptr }; 65 64 main_type->get_returnVals().push_back( 66 65 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) … … 77 76 ); 78 77 79 auto&& name = SymTab::Mangler::mangle( mainDecl .get());78 auto&& name = SymTab::Mangler::mangle( mainDecl ); 80 79 // std::cerr << name << std::endl; 81 80 return name;
Note: See TracChangeset
for help on using the changeset viewer.