Changeset 1619acd for src/CodeGen
- Timestamp:
- Dec 13, 2017, 3:09:24 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 2db79e5
- Parents:
- 90449e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixMain.cc
r90449e4 r1619acd 23 23 24 24 #include "Common/SemanticError.h" // for SemanticError 25 #include "CodeGen/GenType.h" // for GenType 25 26 #include "SynTree/Declaration.h" // for FunctionDecl, operator<< 26 27 #include "SynTree/Type.h" // for FunctionType … … 29 30 bool FixMain::replace_main = false; 30 31 std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr; 32 33 template<typename container> 34 std::string genTypeAt(const container& p, size_t idx) { 35 return genType((*std::next(p.begin(), idx))->get_type(), ""); 36 } 31 37 32 38 void FixMain::registerMain(FunctionDecl* functionDecl) … … 43 49 44 50 os << main_signature->get_scopedMangleName() << "("; 45 switch(main_signature->get_functionType()->get_parameters().size()) { 46 case 3: os << "argc, argv, envp"; break; 47 case 2: os << "argc, argv"; break; 51 const auto& params = main_signature->get_functionType()->get_parameters(); 52 switch(params.size()) { 53 case 3: os << "(" << genTypeAt(params, 0) << ")argc, (" << genTypeAt(params, 1) << ")argv, (" << genTypeAt(params, 2) << ")envp"; break; 54 case 2: os << "(" << genTypeAt(params, 0) << ")argc, (" << genTypeAt(params, 1) << ")argv"; break; 48 55 case 0: break; 49 56 default : assert(false);
Note: See TracChangeset
for help on using the changeset viewer.