Changeset 933f32f for src/main.cc
- Timestamp:
- May 24, 2019, 10:19:41 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d908563
- Parents:
- 6a9d4b4 (diff), 292642a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r6a9d4b4 r933f32f 7 7 // main.cc -- 8 8 // 9 // Author : Richard C. Bilson9 // Author : Peter Buhr and Rob Schluntz 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 26 08:11:19 201813 // Update Count : 49912 // Last Modified On : Fri May 3 16:10:52 2019 13 // Update Count : 599 14 14 // 15 15 … … 24 24 #include <fstream> // for ofstream 25 25 #include <iostream> // for operator<<, basic_ostream 26 #include <iomanip> 26 27 #include <iterator> // for back_inserter 27 28 #include <list> // for list … … 37 38 #include "CodeTools/TrackLoc.h" // for fillLocations 38 39 #include "Common/CompilerError.h" // for CompilerError 39 #include "Common/ Heap.h"40 #include "Common/Stats.h" 40 41 #include "Common/PassVisitor.h" 42 // #include "AST/Pass.hpp" 41 43 #include "Common/SemanticError.h" // for SemanticError 42 44 #include "Common/UnimplementedError.h" // for UnimplementedError … … 65 67 using namespace std; 66 68 67 #define PASS(name, pass) \ 69 static void NewPass( const char * const name ) { 70 Stats::Heap::newPass( name ); 71 using namespace Stats::Counters; 72 { 73 static auto group = build<CounterGroup>( "Pass Visitor" ); 74 auto pass = build<CounterGroup>( name, group ); 75 pass_visitor_stats.depth = 0; 76 pass_visitor_stats.avg = build<AverageCounter<double>>( "Average Depth", pass ); 77 pass_visitor_stats.max = build<MaxCounter<double>>( "Max Depth", pass ); 78 } 79 { 80 static auto group = build<CounterGroup>( "Syntax Node" ); 81 auto pass = build<CounterGroup>( name, group ); 82 BaseSyntaxNode::new_nodes = build<SimpleCounter>( "Allocs", pass ); 83 } 84 } 85 86 #define PASS( name, pass ) \ 68 87 if ( errorp ) { cerr << name << endl; } \ 69 HeapStats::newPass(name); \ 70 pass; 88 NewPass(name); \ 89 Stats::Time::StartBlock(name); \ 90 pass; \ 91 Stats::Time::StopBlock(); 71 92 72 93 LinkageSpec::Spec linkage = LinkageSpec::Cforall; … … 74 95 DeclarationNode * parseTree = nullptr; // program parse tree 75 96 76 st d::string PreludeDirector = "";97 static std::string PreludeDirector = ""; 77 98 78 99 static void parse_cmdline( int argc, char *argv[], const char *& filename ); … … 130 151 } // backtrace 131 152 132 void sigSegvBusHandler( int sig_num ) {153 static void sigSegvBusHandler( int sig_num ) { 133 154 cerr << "*CFA runtime error* program cfa-cpp terminated with " 134 155 << (sig_num == SIGSEGV ? "segment fault" : "bus error") … … 136 157 backtrace( 2 ); // skip first 2 stack frames 137 158 //_exit( EXIT_FAILURE ); 138 abort(); 159 abort(); // cause core dump for debugging 139 160 } // sigSegvBusHandler 140 161 141 void sigAbortHandler( __attribute__((unused)) int sig_num ) {162 static void sigAbortHandler( __attribute__((unused)) int sig_num ) { 142 163 backtrace( 6 ); // skip first 6 stack frames 143 164 signal( SIGABRT, SIG_DFL); // reset default signal handler 144 165 raise( SIGABRT ); // reraise SIGABRT 145 166 } // sigAbortHandler 146 167 … … 148 169 int main( int argc, char * argv[] ) { 149 170 FILE * input; // use FILE rather than istream because yyin is FILE 150 ostream * output = & cout;151 const char * filename = nullptr;171 ostream * output = & cout; 172 const char * filename = nullptr; 152 173 list< Declaration * > translationUnit; 153 174 … … 181 202 } // if 182 203 204 Stats::Time::StartGlobal(); 205 NewPass("Parse"); 206 Stats::Time::StartBlock("Parse"); 207 183 208 // read in the builtins, extras, and the prelude 184 209 if ( ! nopreludep ) { // include gcc builtins … … 215 240 parseTree->printList( cout ); 216 241 delete parseTree; 217 return 0;242 return EXIT_SUCCESS; 218 243 } // if 219 244 … … 224 249 if ( astp ) { 225 250 dump( translationUnit ); 226 return 0;251 return EXIT_SUCCESS; 227 252 } // if 228 253 … … 231 256 // works okay for now. 232 257 CodeTools::fillLocations( translationUnit ); 258 Stats::Time::StopBlock(); 233 259 234 260 // add the assignment statement after the initialization of a type parameter 235 PASS( " validate", SymTab::validate( translationUnit, symtabp ) );261 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) ); 236 262 if ( symtabp ) { 237 263 deleteAll( translationUnit ); 238 return 0;264 return EXIT_SUCCESS; 239 265 } // if 240 266 … … 242 268 PassVisitor<ResolvExpr::AlternativePrinter> printer( cout ); 243 269 acceptAll( translationUnit, printer ); 244 return 0;270 return EXIT_SUCCESS; 245 271 } // if 246 272 247 273 if ( validp ) { 248 274 dump( translationUnit ); 249 return 0;250 } // if 251 252 PASS( " fixLabels", ControlStruct::fixLabels( translationUnit ) );253 PASS( " fixNames", CodeGen::fixNames( translationUnit ) );254 PASS( " genInit", InitTweak::genInit( translationUnit ) );255 PASS( " expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );275 return EXIT_SUCCESS; 276 } // if 277 278 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) ); 279 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) ); 280 PASS( "Gen Init", InitTweak::genInit( translationUnit ) ); 281 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) ); 256 282 if ( libcfap ) { 257 283 // generate the bodies of cfa library functions … … 262 288 CodeTools::printDeclStats( translationUnit ); 263 289 deleteAll( translationUnit ); 264 return 0;265 } 290 return EXIT_SUCCESS; 291 } // if 266 292 267 293 if ( bresolvep ) { 268 294 dump( translationUnit ); 269 return 0;295 return EXIT_SUCCESS; 270 296 } // if 271 297 … … 274 300 if ( resolvprotop ) { 275 301 CodeTools::dumpAsResolvProto( translationUnit ); 276 return 0;277 } 278 279 PASS( " resolve", ResolvExpr::resolve( translationUnit ) );302 return EXIT_SUCCESS; 303 } // if 304 305 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); 280 306 if ( exprp ) { 281 307 dump( translationUnit ); 282 return 0;308 return EXIT_SUCCESS; 283 309 } // if 284 310 285 311 // fix ObjectDecl - replaces ConstructorInit nodes 286 PASS( " fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );312 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) ); 287 313 if ( ctorinitp ) { 288 314 dump ( translationUnit ); 289 return 0;290 } // if 291 292 PASS( " expandUniqueExpr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused293 294 PASS( " translateEHM" , ControlStruct::translateEHM( translationUnit ) );295 296 PASS( " generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );297 298 PASS( " convertSpecializations", GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded299 300 PASS( " expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?315 return EXIT_SUCCESS; 316 } // if 317 318 PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused 319 320 PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) ); 321 322 PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) ); 323 324 PASS( "Convert Specializations", GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded 325 326 PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this? 301 327 302 328 if ( tuplep ) { 303 329 dump( translationUnit ); 304 return 0;305 } 306 307 PASS( " virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM308 309 PASS( " instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );330 return EXIT_SUCCESS; 331 } // if 332 333 PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM 334 335 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) ); 310 336 if ( genericsp ) { 311 337 dump( translationUnit ); 312 return 0;313 } 314 PASS( " convertLvalue", GenPoly::convertLvalue( translationUnit ) );338 return EXIT_SUCCESS; 339 } // if 340 PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) ); 315 341 316 342 317 343 if ( bboxp ) { 318 344 dump( translationUnit ); 319 return 0;320 } // if 321 PASS( " box", GenPoly::box( translationUnit ) );345 return EXIT_SUCCESS; 346 } // if 347 PASS( "Box", GenPoly::box( translationUnit ) ); 322 348 323 349 if ( bcodegenp ) { 324 350 dump( translationUnit ); 325 return 0;326 } 351 return EXIT_SUCCESS; 352 } // if 327 353 328 354 if ( optind < argc ) { // any commands after the flags and input file ? => output file name … … 331 357 332 358 CodeTools::fillLocations( translationUnit ); 333 PASS( " codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );359 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 334 360 335 361 CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() ); … … 347 373 delete output; 348 374 } // if 349 return 1;375 return EXIT_FAILURE; 350 376 } catch ( UnimplementedError &e ) { 351 377 cout << "Sorry, " << e.get_what() << " is not currently implemented" << endl; … … 353 379 delete output; 354 380 } // if 355 return 1;381 return EXIT_FAILURE; 356 382 } catch ( CompilerError &e ) { 357 383 cerr << "Compiler Error: " << e.get_what() << endl; … … 360 386 delete output; 361 387 } // if 362 return 1;363 } catch (...) {388 return EXIT_FAILURE; 389 } catch ( ... ) { 364 390 std::exception_ptr eptr = std::current_exception(); 365 391 try { 366 392 if (eptr) { 367 393 std::rethrow_exception(eptr); 368 } 369 else { 370 std::cerr << "Exception Uncaught and Unkown" << std::endl; 371 } 394 } else { 395 std::cerr << "Exception Uncaught and Unknown" << std::endl; 396 } // if 372 397 } catch(const std::exception& e) { 373 398 std::cerr << "Uncaught Exception \"" << e.what() << "\"\n"; 374 } 375 return 1;376 } // try399 } // try 400 return EXIT_FAILURE; 401 } // try 377 402 378 403 deleteAll( translationUnit ); 379 if(!libcfap && !treep) HeapStats::printStats();380 return 0;404 Stats::print(); 405 return EXIT_SUCCESS; 381 406 } // main 382 407 383 void parse_cmdline( int argc, char * argv[], const char *& filename ) { 384 enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Symbol, Tree, TupleExpansion, Validate, }; 385 386 static struct option long_opts[] = { 387 { "ast", no_argument, 0, Ast }, 388 { "before-box", no_argument, 0, Bbox }, 389 { "before-resolver", no_argument, 0, Bresolver }, 390 { "ctorinitfix", no_argument, 0, CtorInitFix }, 391 { "decl-stats", no_argument, 0, DeclStats }, 392 { "expr", no_argument, 0, Expr }, 393 { "expralt", no_argument, 0, ExprAlt }, 394 { "grammar", no_argument, 0, Grammar }, 395 { "libcfa", no_argument, 0, LibCFA }, 396 { "line-marks", no_argument, 0, Linemarks }, 397 { "no-line-marks", no_argument, 0, Nolinemarks }, 398 { "no-preamble", no_argument, 0, Nopreamble }, 399 { "parse", no_argument, 0, Parse }, 400 { "prelude-dir", required_argument, 0, PreludeDir }, 401 { "no-prototypes", no_argument, 0, Prototypes }, 402 { "resolver", no_argument, 0, Resolver }, 403 { "resolv-proto", no_argument, 0, ResolvProto }, 404 { "symbol", no_argument, 0, Symbol }, 405 { "tree", no_argument, 0, Tree }, 406 { "tuple-expansion", no_argument, 0, TupleExpansion }, 407 { "validate", no_argument, 0, Validate }, 408 { 0, 0, 0, 0 } 409 }; // long_opts 410 int long_index; 411 408 409 static const char optstring[] = ":hlLmNn:pP:S:twW:D:F:"; 410 411 enum { PreludeDir = 128 }; 412 static struct option long_opts[] = { 413 { "help", no_argument, nullptr, 'h' }, 414 { "libcfa", no_argument, nullptr, 'l' }, 415 { "linemarks", no_argument, nullptr, 'L' }, 416 { "no-main", no_argument, 0, 'm' }, 417 { "no-linemarks", no_argument, nullptr, 'N' }, 418 { "no-prelude", no_argument, nullptr, 'n' }, 419 { "prototypes", no_argument, nullptr, 'p' }, 420 { "print", required_argument, nullptr, 'P' }, 421 { "prelude-dir", required_argument, nullptr, PreludeDir }, 422 { "statistics", required_argument, nullptr, 'S' }, 423 { "tree", no_argument, nullptr, 't' }, 424 { "", no_argument, nullptr, 0 }, // -w 425 { "", no_argument, nullptr, 0 }, // -W 426 { "", no_argument, nullptr, 0 }, // -D 427 { "", no_argument, nullptr, 0 }, // -F 428 { nullptr, 0, nullptr, 0 } 429 }; // long_opts 430 431 static const char * description[] = { 432 "print help message", // -h 433 "generate libcfa.c", // -l 434 "generate line marks", // -L 435 "do not replace main", // -m 436 "do not generate line marks", // -N 437 "do not read prelude", // -n 438 "generate prototypes for prelude functions", // -p 439 "print", // -P 440 "<directory> prelude directory for debug/nodebug", // no flag 441 "<option-list> enable profiling information:\n counters,heap,time,all,none", // -S 442 "build in tree", // -t 443 "", // -w 444 "", // -W 445 "", // -D 446 "", // -F 447 }; // description 448 449 static_assert( sizeof( long_opts ) / sizeof( long_opts[0] ) - 1 == sizeof( description ) / sizeof( description[0] ), "Long opts and description must match" ); 450 451 static struct Printopts { 452 const char * name; 453 int & flag; 454 int val; 455 const char * descript; 456 } printopts[] = { 457 { "altexpr", expraltp, true, "alternatives for expressions" }, 458 { "ascodegen", codegenp, true, "as codegen rather than AST" }, 459 { "ast", astp, true, "AST after parsing" }, 460 { "astdecl", validp, true, "AST after declaration validation pass" }, 461 { "asterr", errorp, true, "AST on error" }, 462 { "astexpr", exprp, true, "AST after expression analysis" }, 463 { "astgen", genericsp, true, "AST after instantiate generics" }, 464 { "box", bboxp, true, "before box step" }, 465 { "ctordtor", ctorinitp, true, "after ctor/dtor are replaced" }, 466 { "codegen", bcodegenp, true, "before code generation" }, 467 { "declstats", declstatsp, true, "code property statistics" }, 468 { "parse", yydebug, true, "yacc (parsing) debug information" }, 469 { "pretty", prettycodegenp, true, "prettyprint for ascodegen flag" }, 470 { "resolver", bresolvep, true, "before resolver step" }, 471 { "rproto", resolvprotop, true, "resolver-proto instance" }, 472 { "rsteps", resolvep, true, "resolver steps" }, 473 { "symevt", symtabp, true, "symbol table events" }, 474 { "tree", parsep, true, "parse tree" }, 475 { "tuple", tuplep, true, "after tuple expansion" }, 476 }; 477 enum { printoptsSize = sizeof( printopts ) / sizeof( printopts[0] ) }; 478 479 static void usage( char *argv[] ) { 480 cout << "Usage: " << argv[0] << " options are:" << endl; 481 int i = 0, j = 1; // j skips starting colon 482 for ( ; long_opts[i].name != 0 && optstring[j] != '\0'; i += 1, j += 1 ) { 483 if ( long_opts[i].name[0] != '\0' ) { // hidden option, internal usage only 484 if ( strcmp( long_opts[i].name, "prelude-dir" ) != 0 ) { // flag 485 cout << " -" << optstring[j] << ","; 486 } else { // no flag 487 j -= 1; // compensate 488 cout << " "; 489 } // if 490 cout << " --" << left << setw(12) << long_opts[i].name << " "; 491 if ( strcmp( long_opts[i].name, "print" ) == 0 ) { 492 cout << "one of: " << endl; 493 for ( int i = 0; i < printoptsSize; i += 1 ) { 494 cout << setw(10) << " " << left << setw(10) << printopts[i].name << " " << printopts[i].descript << endl; 495 } // for 496 } else { 497 cout << description[i] << endl; 498 } // if 499 } // if 500 if ( optstring[j + 1] == ':' ) j += 1; 501 } // for 502 if ( long_opts[i].name != 0 || optstring[j] != '\0' ) assertf( false, "internal error, mismatch of option flags and names\n" ); 503 exit( EXIT_FAILURE ); 504 } // usage 505 506 static void parse_cmdline( int argc, char * argv[], const char *& filename ) { 412 507 opterr = 0; // (global) prevent getopt from printing error messages 413 508 414 509 bool Wsuppress = false, Werror = false; 415 510 int c; 416 while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrRstTvwW:yzZD:F:", long_opts, &long_index)) != -1 ) {511 while ( (c = getopt_long( argc, argv, optstring, long_opts, nullptr )) != -1 ) { 417 512 switch ( c ) { 418 case Ast: 419 case 'a': // dump AST 420 astp = true; 421 break; 422 case Bresolver: 423 case 'b': // print before resolver steps 424 bresolvep = true; 425 break; 426 case 'B': // print before box steps 427 bboxp = true; 428 break; 429 case CtorInitFix: 430 case 'c': // print after constructors and destructors are replaced 431 ctorinitp = true; 432 break; 433 case 'C': // print before code generation 434 bcodegenp = true; 435 break; 436 case DeclStats: 437 case 'd': 438 declstatsp = true; 439 break; 440 case Expr: 441 case 'e': // dump AST after expression analysis 442 exprp = true; 443 break; 444 case ExprAlt: 445 case 'f': // print alternatives for expressions 446 expraltp = true; 447 break; 448 case Grammar: 449 case 'g': // bison debugging info (grammar rules) 450 yydebug = true; 451 break; 452 case 'G': // dump AST after instantiate generics 453 genericsp = true; 454 break; 455 case LibCFA: 513 case 'h': // help message 514 usage( argv ); // no return 515 break; 456 516 case 'l': // generate libcfa.c 457 517 libcfap = true; 458 518 break; 459 case Linemarks: 460 case 'L': // print lines marks 519 case 'L': // generate line marks 461 520 linemarks = true; 462 521 break; 463 case Nopreamble: 464 case 'n': // do not read preamble 522 case 'm': // do not replace main 523 nomainp = true; 524 break; 525 case 'N': // do not generate line marks 526 linemarks = false; 527 break; 528 case 'n': // do not read prelude 465 529 nopreludep = true; 466 530 break; 467 case Nolinemarks: 468 case 'N': // suppress line marks 469 linemarks = false; 470 break; 471 case Prototypes: 472 case 'p': // generate prototypes for preamble functions 473 noprotop = true; 474 break; 475 case PreludeDir: 476 PreludeDirector = optarg; 477 break; 478 case 'm': // don't replace the main 479 nomainp = true; 480 break; 481 case Parse: 482 case 'q': // dump parse tree 483 parsep = true; 484 break; 485 case Resolver: 486 case 'r': // print resolver steps 487 resolvep = true; 488 break; 489 case 'R': // dump resolv-proto instance 490 resolvprotop = true; 491 break; 492 case Symbol: 493 case 's': // print symbol table events 494 symtabp = true; 495 break; 496 case Tree: 531 case 'p': // generate prototypes for prelude functions 532 genproto = true; 533 break; 534 case 'P': // print options 535 for ( int i = 0;; i += 1 ) { 536 if ( i == printoptsSize ) { 537 cout << "Unknown --print option " << optarg << endl; 538 goto Default; 539 } // if 540 if ( strcmp( optarg, printopts[i].name ) == 0 ) { 541 printopts[i].flag = printopts[i].val; 542 break; 543 } // if 544 } // for 545 break; 546 case PreludeDir: // prelude directory for debug/nodebug, hidden 547 PreludeDirector = optarg; 548 break; 549 case 'S': // enable profiling information, argument comma separated list of names 550 Stats::parse_params( optarg ); 551 break; 497 552 case 't': // build in tree 498 553 treep = true; 499 554 break; 500 case TupleExpansion: 501 case 'T': // print after tuple expansion 502 tuplep = true; 503 break; 504 case 'v': // dump AST after decl validation pass 505 validp = true; 506 break; 507 case 'w': 555 case 'w': // suppress all warnings, hidden 508 556 Wsuppress = true; 509 557 break; 510 case 'W': 558 case 'W': // coordinate gcc -W with CFA, hidden 511 559 if ( strcmp( optarg, "all" ) == 0 ) { 512 560 SemanticWarning_EnableAll(); … … 525 573 } // if 526 574 break; 527 case 'y': // dump AST on error 528 errorp = true; 529 break; 530 case 'z': // dump as codegen rather than AST 531 codegenp = true; 532 break; 533 case 'Z': // prettyprint during codegen (i.e. print unmangled names, etc.) 534 prettycodegenp = true; 535 break; 536 case 'D': // ignore -Dxxx 537 break; 538 case 'F': // source file-name without suffix 575 case 'D': // ignore -Dxxx, forwarded by cpp, hidden 576 break; 577 case 'F': // source file-name without suffix, hidden 539 578 filename = optarg; 540 579 break; 541 case '?': 580 case '?': // unknown option 542 581 if ( optopt ) { // short option ? 543 assertf( false, "Unknown option: -%c\n", (char)optopt );582 cout << "Unknown option -" << (char)optopt << endl; 544 583 } else { 545 assertf( false, "Unknown option: %s\n", argv[optind - 1] ); 546 } // if 547 #if defined(__GNUC__) && __GNUC__ >= 7 548 __attribute__((fallthrough)); 549 #endif 584 cout << "Unknown option " << argv[optind - 1] << endl; 585 } // if 586 goto Default; 587 case ':': // missing option 588 if ( optopt ) { // short option ? 589 cout << "Missing option for -" << (char)optopt << endl; 590 } else { 591 cout << "Missing option for " << argv[optind - 1] << endl; 592 } // if 593 goto Default; 594 Default: 550 595 default: 551 abort();596 usage( argv ); // no return 552 597 } // switch 553 598 } // while … … 587 632 list< Declaration * > decls; 588 633 589 if ( noprotop) {634 if ( genproto ) { 590 635 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), notPrelude ); 591 636 } else { … … 595 640 // depending on commandline options, either generate code or dump the AST 596 641 if ( codegenp ) { 597 CodeGen::generate( decls, out, ! noprotop, prettycodegenp );642 CodeGen::generate( decls, out, ! genproto, prettycodegenp ); 598 643 } else { 599 644 printAll( decls, out ); 600 } 645 } // if 601 646 deleteAll( translationUnit ); 602 647 } // dump
Note:
See TracChangeset
for help on using the changeset viewer.