Changes in src/main.cc [b4f8808:e0bd0f9]
- File:
-
- 1 edited
-
src/main.cc (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
rb4f8808 re0bd0f9 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 23 06:50:08 201913 // Update Count : 60 712 // Last Modified On : Thu Aug 22 13:06:18 2019 13 // Update Count : 605 14 14 // 15 15 … … 17 17 #include <execinfo.h> // for backtrace, backtrace_symbols 18 18 #include <getopt.h> // for no_argument, optind, geto... 19 #include <signal.h> // for signal, SIGABRT, SIGSEGV 19 20 #include <cassert> // for assertf 20 21 #include <cstdio> // for fopen, FILE, fclose, stdin 21 22 #include <cstdlib> // for exit, free, abort, EXIT_F... 22 #include <csignal> // for signal, SIGABRT, SIGSEGV23 23 #include <cstring> // for index 24 24 #include <fstream> // for ofstream … … 59 59 #include "ResolvExpr/Resolver.h" // for resolve 60 60 #include "SymTab/Validate.h" // for validate 61 #include "SynTree/TopLvalue.h" // for assertTopLvalue, clearInn... 61 62 #include "SynTree/Declaration.h" // for Declaration 62 63 #include "SynTree/Visitor.h" // for acceptAll … … 95 96 DeclarationNode * parseTree = nullptr; // program parse tree 96 97 97 static bool waiting_for_gdb = false; // flag to set cfa-cpp to wait for gdb on start98 99 98 static std::string PreludeDirector = ""; 100 99 … … 168 167 } // sigAbortHandler 169 168 169 170 170 int main( int argc, char * argv[] ) { 171 171 FILE * input; // use FILE rather than istream because yyin is FILE … … 184 184 parse_cmdline( argc, argv ); // process command-line arguments 185 185 CodeGen::FixMain::setReplaceMain( !nomainp ); 186 187 if ( waiting_for_gdb ) {188 std::cerr << "Waiting for gdb" << std::endl;189 std::cerr << "run :" << std::endl;190 std::cerr << " gdb attach " << getpid() << std::endl;191 raise(SIGSTOP);192 } // if193 186 194 187 try { … … 258 251 Stats::Time::StopBlock(); 259 252 253 //std::cerr << "Post-Parse Check" << std::endl; 254 clearInnerLvalue( translationUnit ); 255 assertTopLvalue( translationUnit ); 256 260 257 // add the assignment statement after the initialization of a type parameter 261 258 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) ); … … 276 273 } // if 277 274 275 assertTopLvalue( translationUnit ); 278 276 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) ); 277 assertTopLvalue( translationUnit ); 279 278 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) ); 279 assertTopLvalue( translationUnit ); 280 280 PASS( "Gen Init", InitTweak::genInit( translationUnit ) ); 281 assertTopLvalue( translationUnit ); 281 282 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) ); 283 assertTopLvalue( translationUnit ); 282 284 if ( libcfap ) { 283 285 // generate the bodies of cfa library functions … … 303 305 } // if 304 306 307 assertTopLvalue( translationUnit ); 308 305 309 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); 306 310 if ( exprp ) { … … 309 313 } // if 310 314 315 clearInnerLvalue( translationUnit ); 316 assertTopLvalue( translationUnit ); 317 311 318 // fix ObjectDecl - replaces ConstructorInit nodes 312 319 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) ); 320 clearInnerLvalue( translationUnit ); 321 assertTopLvalue( translationUnit ); 313 322 if ( ctorinitp ) { 314 323 dump ( translationUnit ); … … 317 326 318 327 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 328 assertTopLvalue( translationUnit ); 319 329 320 330 PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) ); 331 assertTopLvalue( translationUnit ); 321 332 322 333 PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) ); 334 clearInnerLvalue( translationUnit ); 335 assertTopLvalue( translationUnit ); 323 336 324 337 PASS( "Convert Specializations", GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded 338 clearInnerLvalue( translationUnit ); 339 assertTopLvalue( translationUnit ); 325 340 326 341 PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this? 342 assertTopLvalue( translationUnit ); 327 343 328 344 if ( tuplep ) { … … 332 348 333 349 PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM 350 assertTopLvalue( translationUnit ); 334 351 335 352 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) ); … … 338 355 return EXIT_SUCCESS; 339 356 } // if 340 357 clearInnerLvalue( translationUnit ); 358 assertTopLvalue( translationUnit ); 341 359 PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) ); 360 clearInnerLvalue( translationUnit ); 361 assertTopLvalue( translationUnit ); 342 362 343 363 if ( bboxp ) { … … 346 366 } // if 347 367 PASS( "Box", GenPoly::box( translationUnit ) ); 368 clearInnerLvalue( translationUnit ); 369 assertTopLvalue( translationUnit ); 348 370 349 371 if ( bcodegenp ) { … … 357 379 358 380 CodeTools::fillLocations( translationUnit ); 381 assertTopLvalue( translationUnit ); 359 382 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 360 383 … … 422 445 { "statistics", required_argument, nullptr, 'S' }, 423 446 { "tree", no_argument, nullptr, 't' }, 424 { "gdb", no_argument, nullptr, 'g' },425 447 { "", no_argument, nullptr, 0 }, // -w 426 448 { "", no_argument, nullptr, 0 }, // -W … … 440 462 "<directory> prelude directory for debug/nodebug", // no flag 441 463 "<option-list> enable profiling information:\n counters,heap,time,all,none", // -S 442 "building cfa standard lib", // -t 443 "wait for gdb to attach", // -g 464 "build in tree", // -t 444 465 "", // -w 445 466 "", // -W … … 551 572 Stats::parse_params( optarg ); 552 573 break; 553 case 't': // build ing cfa stdlib574 case 't': // build in tree 554 575 treep = true; 555 break;556 case 'g': // wait for gdb557 waiting_for_gdb = true;558 576 break; 559 577 case 'w': // suppress all warnings, hidden
Note:
See TracChangeset
for help on using the changeset viewer.