Changes in src/main.cc [626dbc10:3fe34ae]
- File:
-
- 1 edited
-
src/main.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r626dbc10 r3fe34ae 14 14 // 15 15 16 #include <memory> 16 17 #include <iostream> 17 18 #include <fstream> … … 65 66 nopreludep = false, 66 67 noprotop = false, 68 nomainp = false, 67 69 parsep = false, 68 70 resolvep = false, // used in AlternativeFinder … … 77 79 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 78 80 static void dump( list< Declaration * > & translationUnit, ostream & out = cout ); 81 82 bool translation_unit_nomain = true; 83 std::unique_ptr<FunctionDecl> translation_unit_main_signature = nullptr; 79 84 80 85 static void backtrace( int start ) { // skip first N stack frames … … 154 159 155 160 parse_cmdline( argc, argv, filename ); // process command-line arguments 161 translation_unit_nomain = nomainp; 156 162 157 163 try { … … 299 305 300 306 CodeGen::generate( translationUnit, *output, ! noprotop ); 307 308 if( translation_unit_main_signature ) { 309 *output << "int main(int argc, char** argv) { return "; 310 311 *output << translation_unit_main_signature->get_scopedMangleName() << "("; 312 if(translation_unit_main_signature->get_functionType()->get_parameters().size() != 0){ 313 *output << "argc, argv"; 314 } 315 *output << ");"; 316 317 *output << " }\n"; 318 } 301 319 302 320 if ( output != &cout ) { … … 360 378 361 379 int c; 362 while ( (c = getopt_long( argc, argv, "abBcefgl npqrstTvyzD:F:", long_opts, &long_index )) != -1 ) {380 while ( (c = getopt_long( argc, argv, "abBcefglmnpqrstTvyzD:F:", long_opts, &long_index )) != -1 ) { 363 381 switch ( c ) { 364 382 case Ast: … … 400 418 case 'p': // generate prototypes for preamble functions 401 419 noprotop = true; 420 break; 421 case 'm': // don't replace the main 422 nomainp = true; 402 423 break; 403 424 case Parse:
Note:
See TracChangeset
for help on using the changeset viewer.