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