Changeset 13de47bc for src/main.cc
- Timestamp:
- Jan 12, 2017, 3:28:29 PM (8 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:
- aaa1a99a
- Parents:
- 7cc2c8d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r7cc2c8d r13de47bc 14 14 // 15 15 16 #include <memory>17 16 #include <iostream> 18 17 #include <fstream> … … 35 34 #include "CodeGen/Generate.h" 36 35 #include "CodeGen/FixNames.h" 36 #include "CodeGen/FixMain.h" 37 37 #include "ControlStruct/Mutate.h" 38 38 #include "SymTab/Validate.h" … … 80 80 static void dump( list< Declaration * > & translationUnit, ostream & out = cout ); 81 81 82 bool translation_unit_nomain = true;83 std::unique_ptr<FunctionDecl> translation_unit_main_signature = nullptr;84 85 82 static void backtrace( int start ) { // skip first N stack frames 86 83 enum { Frames = 50 }; … … 159 156 160 157 parse_cmdline( argc, argv, filename ); // process command-line arguments 161 translation_unit_nomain = nomainp;158 CodeGen::FixMain::setReplaceMain( !nomainp ); 162 159 163 160 try { … … 178 175 } // if 179 176 180 if ( optind < argc ) { // any commands after the flags and input file ? => output file name181 output = new ofstream( argv[ optind ] );182 } // if183 184 177 // read in the builtins, extras, and the prelude 185 178 if ( ! nopreludep ) { // include gcc builtins … … 304 297 } // if 305 298 299 if ( optind < argc ) { // any commands after the flags and input file ? => output file name 300 output = new ofstream( argv[ optind ] ); 301 } // if 302 306 303 CodeGen::generate( translationUnit, *output, ! noprotop ); 307 304 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 } 305 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" ); 319 306 320 307 if ( output != &cout ) {
Note: See TracChangeset
for help on using the changeset viewer.