- Timestamp:
- Sep 10, 2019, 2:48:01 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 81e60f7
- Parents:
- 17bc05b (diff), 216597d (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. - Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r17bc05b rc2051e10 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 12:27:10 2015 11 // Last Modified By : A aron B. Moss12 // Last Modified On : Mon Jun 18 11:58:00 201813 // Update Count : 4 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Sep 4 10:00:00 2019 13 // Update Count : 44 14 14 // 15 15 … … 278 278 #endif 279 279 if ( ( common = commonType( type1, type2, widen.first, widen.second, indexer, env, openVars ) ) ) { 280 common-> get_qualifiers() = tq1 | tq2;280 common->tq = tq1.unify( tq2 ); 281 281 #ifdef DEBUG 282 282 std::cerr << "unifyInexact: common type is "; … … 295 295 if ( ( tq1 > tq2 || widen.first ) && ( tq2 > tq1 || widen.second ) ) { 296 296 common = type1->clone(); 297 common-> get_qualifiers() = tq1 | tq2;297 common->tq = tq1.unify( tq2 ); 298 298 result = true; 299 299 } else { … … 302 302 } else { 303 303 common = type1->clone(); 304 common-> get_qualifiers() = tq1 | tq2;304 common->tq = tq1.unify( tq2 ); 305 305 result = true; 306 306 } // if -
src/SynTree/Expression.cc
r17bc05b rc2051e10 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T ue Aug 13 11:31:00 201913 // Update Count : 6 312 // Last Modified On : Thr Aug 15 13:43:00 2019 13 // Update Count : 64 14 14 // 15 15 … … 646 646 result = new VoidType( Type::Qualifiers() ); 647 647 } 648 } 649 bool StmtExpr::get_lvalue() const { 650 return result->get_lvalue(); 648 651 } 649 652 void StmtExpr::print( std::ostream & os, Indenter indent ) const { -
src/SynTree/Expression.h
r17bc05b rc2051e10 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 14 14:24:00 201913 // Update Count : 5 312 // Last Modified On : Thr Aug 15 13:46:00 2019 13 // Update Count : 54 14 14 // 15 15 … … 777 777 virtual ~StmtExpr(); 778 778 779 bool get_lvalue() const final; 780 779 781 CompoundStmt * get_statements() const { return statements; } 780 782 StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; } -
src/SynTree/Type.h
r17bc05b rc2051e10 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Feb 14 17:11:24201913 // Update Count : 1 6911 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Sep 4 09:58:00 2019 13 // Update Count : 170 14 14 // 15 15 … … 131 131 bool operator>( Qualifiers other ) const { return *this != other && *this >= other; } 132 132 BFCommon( Qualifiers, NumTypeQualifier ) 133 134 Qualifiers unify( Qualifiers const & other ) const { 135 int or_flags = Mask & (val | other.val); 136 int and_flags = val & other.val; 137 return Qualifiers( or_flags | and_flags ); 138 } 133 139 }; // Qualifiers 134 140 -
src/main.cc
r17bc05b rc2051e10 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 5 20:35:13201913 // Update Count : 60 112 // Last Modified On : Fri Aug 23 06:50:08 2019 13 // Update Count : 607 14 14 // 15 15 … … 96 96 DeclarationNode * parseTree = nullptr; // program parse tree 97 97 98 static bool waiting_for_gdb = false; 98 static bool waiting_for_gdb = false; // flag to set cfa-cpp to wait for gdb on start 99 99 100 100 static std::string PreludeDirector = ""; 101 101 102 static void parse_cmdline( int argc, char *argv[] , const char *& filename);102 static void parse_cmdline( int argc, char *argv[] ); 103 103 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 104 104 static void dump( list< Declaration * > & translationUnit, ostream & out = cout ); … … 172 172 FILE * input; // use FILE rather than istream because yyin is FILE 173 173 ostream * output = & cout; 174 const char * filename = nullptr;175 174 list< Declaration * > translationUnit; 176 175 … … 184 183 // } // for 185 184 186 parse_cmdline( argc, argv , filename );// process command-line arguments185 parse_cmdline( argc, argv ); // process command-line arguments 187 186 CodeGen::FixMain::setReplaceMain( !nomainp ); 188 187 189 if (waiting_for_gdb) {188 if ( waiting_for_gdb ) { 190 189 std::cerr << "Waiting for gdb" << std::endl; 191 190 std::cerr << "run :" << std::endl; 192 191 std::cerr << " gdb attach " << getpid() << std::endl; 193 192 raise(SIGSTOP); 194 } 193 } // if 195 194 196 195 try { … … 198 197 if ( optind < argc ) { // any commands after the flags ? => input file name 199 198 input = fopen( argv[ optind ], "r" ); 200 assertf( input, "cannot open %s\n", argv[ optind ] ); 201 // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to) 202 if ( filename == nullptr ) filename = argv[ optind ]; 203 // prelude filename comes in differently 204 if ( libcfap ) filename = "prelude.cfa"; 199 assertf( input, "cannot open %s because %s\n", argv[ optind ], strerror( errno ) ); 205 200 optind += 1; 206 201 } else { // no input file name 207 202 input = stdin; 208 std::cerr << "Input from stdin" << std::endl;209 // if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass210 // a fake name along211 if ( filename == nullptr ) filename = "stdin";212 203 } // if 213 204 … … 447 438 448 439 449 static const char optstring[] = ":hlLmNnpP:S:t gwW:D:F:";440 static const char optstring[] = ":hlLmNnpP:S:twW:D:"; 450 441 451 442 enum { PreludeDir = 128 }; … … 466 457 { "", no_argument, nullptr, 0 }, // -W 467 458 { "", no_argument, nullptr, 0 }, // -D 468 { "", no_argument, nullptr, 0 }, // -F469 459 { nullptr, 0, nullptr, 0 } 470 460 }; // long_opts … … 486 476 "", // -W 487 477 "", // -D 488 "", // -F489 478 }; // description 490 479 … … 521 510 522 511 static void usage( char *argv[] ) { 523 cout << "Usage: " << argv[0] << " options are:" << endl;512 cout << "Usage: " << argv[0] << " [options] [input-file (default stdin)] [output-file (default stdout)], where options are:" << endl; 524 513 int i = 0, j = 1; // j skips starting colon 525 514 for ( ; long_opts[i].name != 0 && optstring[j] != '\0'; i += 1, j += 1 ) { … … 547 536 } // usage 548 537 549 static void parse_cmdline( int argc, char * argv[] , const char *& filename) {538 static void parse_cmdline( int argc, char * argv[] ) { 550 539 opterr = 0; // (global) prevent getopt from printing error messages 551 540 … … 621 610 case 'D': // ignore -Dxxx, forwarded by cpp, hidden 622 611 break; 623 case 'F': // source file-name without suffix, hidden624 filename = optarg;625 break;626 612 case '?': // unknown option 627 613 if ( optopt ) { // short option ?
Note: See TracChangeset
for help on using the changeset viewer.