Changes in src/CodeGen/FixNames.cc [aaa1a99a:0270824]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixNames.cc
raaa1a99a r0270824 22 22 #include "SymTab/Mangler.h" 23 23 #include "OperatorTable.h" 24 #include "FixMain.h" 24 25 extern std::unique_ptr<FunctionDecl> translation_unit_main_signature; 25 26 26 27 namespace CodeGen { … … 118 119 119 120 if(is_main( SymTab::Mangler::mangle(functionDecl, true, true) )) { 120 int nargs = functionDecl->get_functionType()->get_parameters().size(); 121 if( !(nargs == 0 || nargs == 2 || nargs == 3) ) { 122 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 121 if(translation_unit_main_signature) { 122 throw SemanticError("Multiple definition of main routine\n", functionDecl); 123 123 } 124 124 125 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), "0") ) ) ); 125 CodeGen::FixMain::registerMain( functionDecl);126 translation_unit_main_signature.reset( functionDecl->clone() ); 126 127 } 127 128 }
Note: See TracChangeset
for help on using the changeset viewer.