Changes in src/main.cc [7b937575:711eee5]
- File:
-
- 1 edited
-
src/main.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r7b937575 r711eee5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // main.cc -- 7 // main.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed May 4 23:32:59201613 // Update Count : 20311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 04 16:54:52 2016 13 // Update Count : 199 14 14 // 15 15 … … 41 41 #include "InitTweak/Mutate.h" 42 42 #include "InitTweak/RemoveInit.h" 43 #include "InitTweak/FixGlobalInit.h" 43 44 //#include "Explain/GenProlog.h" 44 45 //#include "Try/Visit.h" … … 97 98 std::ostream *output = &std::cout; 98 99 int long_index; 99 std::list< Declaration * > translationUnit; 100 const char *filename = NULL;; 100 std::list< Declaration* > translationUnit; 101 101 102 102 opterr = 0; // prevent getopt from printing error messages 103 103 104 104 int c; 105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD: F:", long_opts, &long_index )) != -1 ) {105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:", long_opts, &long_index )) != -1 ) { 106 106 switch ( c ) { 107 107 case Ast: … … 163 163 break; 164 164 case 'D': // ignore -Dxxx 165 break;166 case 'F': // source file-name without suffix167 filename = optarg;168 165 break; 169 166 case '?': … … 176 173 177 174 try { 175 std::string fileName; 176 178 177 // choose to read the program from a file or stdin 179 178 if ( optind < argc ) { 180 179 input = fopen( argv[ optind ], "r" ); 181 180 if ( ! input ) { 182 std::cout << "Error: can't open " << argv[ optind] << std::endl;181 std::cout << "Error: can't open " << argv[ optind ] << std::endl; 183 182 exit( 1 ); 184 183 } // if 185 184 optind += 1; 185 186 // assert( optind < argc ); 187 fileName = argv[ optind-1 ]; // placeholder 188 // optind += 1; 186 189 } else { 187 190 input = stdin; … … 191 194 output = new ofstream( argv[ optind ] ); 192 195 } // if 193 196 194 197 Parser::get_parser().set_debug( grammarp ); 195 198 … … 212 215 exit( 1 ); 213 216 } // if 214 217 215 218 parse( prelude, LinkageSpec::Intrinsic ); 216 219 } // if 217 220 } // if 218 221 219 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 220 222 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 223 221 224 if ( parsep ) { 222 225 Parser::get_parser().get_parseTree()->printList( std::cout ); … … 253 256 OPTPRINT( "mutate" ) 254 257 ControlStruct::mutate( translationUnit ); 255 OPTPRINT( "fixNames" ) 258 OPTPRINT( "fixNames" ) 256 259 CodeGen::fixNames( translationUnit ); 260 OPTPRINT( "fixGlobalInit" ); 261 InitTweak::fixGlobalInit( translationUnit, fileName ); 257 262 OPTPRINT( "tweak" ) 258 263 InitTweak::tweak( translationUnit ); … … 282 287 OPTPRINT( "box" ) 283 288 GenPoly::box( translationUnit ); 284 289 285 290 // print tree right before code generation 286 291 if ( codegenp ) { … … 338 343 std::list< Declaration * > decls; 339 344 if ( noprotop ) { 340 filter( translationUnit.begin(), translationUnit.end(), 345 filter( translationUnit.begin(), translationUnit.end(), 341 346 std::back_inserter( decls ), notPrelude ); 342 347 } else {
Note:
See TracChangeset
for help on using the changeset viewer.