Changeset af18713
- Timestamp:
- May 11, 2016, 1:09:37 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 228851d, 3e8fb3b
- Parents:
- cb4c607 (diff), 03e5d14 (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:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/CodeGen/CodeGenerator.cc ¶
rcb4c607 raf18713 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // CodeGenerator.cc -- 7 // CodeGenerator.cc -- 8 8 // 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 : Wed Mar 2 17:32:16201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 15:40:35 2016 13 13 // Update Count : 243 14 14 // … … 75 75 //*** Declarations 76 76 void CodeGenerator::visit( FunctionDecl *functionDecl ) { 77 // generalize this 78 FunctionDecl::Attribute attr = functionDecl->get_attribute(); 79 switch ( attr.type ) { 80 case FunctionDecl::Attribute::Constructor: 81 output << "__attribute__ ((constructor"; 82 if ( attr.priority != FunctionDecl::Attribute::Default ) { 83 output << "(" << attr.priority << ")"; 84 } 85 output << ")) "; 86 break; 87 case FunctionDecl::Attribute::Destructor: 88 output << "__attribute__ ((destructor"; 89 if ( attr.priority != FunctionDecl::Attribute::Default ) { 90 output << "(" << attr.priority << ")"; 91 } 92 output << ")) "; 93 break; 94 default: 95 break; 96 } 77 97 handleStorageClass( functionDecl ); 78 98 if ( functionDecl->get_isInline() ) { … … 99 119 handleStorageClass( objectDecl ); 100 120 output << genType( objectDecl->get_type(), mangleName( objectDecl ) ); 101 121 102 122 if ( objectDecl->get_init() ) { 103 123 output << " = "; … … 113 133 if ( aggDecl->get_name() != "" ) 114 134 output << aggDecl->get_name(); 115 135 116 136 std::list< Declaration * > &memb = aggDecl->get_members(); 117 137 … … 119 139 output << " {" << endl; 120 140 121 cur_indent += CodeGenerator::tabsize; 141 cur_indent += CodeGenerator::tabsize; 122 142 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 123 output << indent; 143 output << indent; 124 144 (*i)->accept( *this ); 125 145 output << ";" << endl; 126 146 } 127 147 128 cur_indent -= CodeGenerator::tabsize; 148 cur_indent -= CodeGenerator::tabsize; 129 149 130 150 output << indent << "}"; … … 141 161 handleAggregate( aggregateDecl ); 142 162 } 143 163 144 164 void CodeGenerator::visit( EnumDecl *aggDecl ) { 145 165 output << "enum "; … … 147 167 if ( aggDecl->get_name() != "" ) 148 168 output << aggDecl->get_name(); 149 169 150 170 std::list< Declaration* > &memb = aggDecl->get_members(); 151 171 … … 153 173 output << " {" << endl; 154 174 155 cur_indent += CodeGenerator::tabsize; 175 cur_indent += CodeGenerator::tabsize; 156 176 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 157 177 ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i ); 158 178 assert( obj ); 159 output << indent << mangleName( obj ); 179 output << indent << mangleName( obj ); 160 180 if ( obj->get_init() ) { 161 181 output << " = "; … … 165 185 } // for 166 186 167 cur_indent -= CodeGenerator::tabsize; 187 cur_indent -= CodeGenerator::tabsize; 168 188 169 189 output << indent << "}"; 170 190 } // if 171 191 } 172 192 173 193 void CodeGenerator::visit( TraitDecl *aggregateDecl ) {} 174 194 175 195 void CodeGenerator::visit( TypedefDecl *typeDecl ) { 176 196 output << "typedef "; 177 197 output << genType( typeDecl->get_base(), typeDecl->get_name() ); 178 198 } 179 199 180 200 void CodeGenerator::visit( TypeDecl *typeDecl ) { 181 201 // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes, … … 217 237 } 218 238 219 void CodeGenerator::visit( Constant *constant ) { 239 void CodeGenerator::visit( Constant *constant ) { 220 240 output << constant->get_value() ; 221 241 } … … 234 254 assert( arg != applicationExpr->get_args().end() ); 235 255 if ( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) { 236 256 237 257 *arg = addrExpr->get_arg(); 238 258 } else { … … 243 263 break; 244 264 } 245 265 246 266 default: 247 267 // do nothing 248 268 ; 249 269 } 250 270 251 271 switch ( opInfo.type ) { 252 272 case OT_INDEX: … … 257 277 output << "]"; 258 278 break; 259 279 260 280 case OT_CALL: 261 281 // there are no intrinsic definitions of the function call operator 262 282 assert( false ); 263 283 break; 264 284 265 285 case OT_PREFIX: 266 286 case OT_PREFIXASSIGN: … … 271 291 output << ")"; 272 292 break; 273 293 274 294 case OT_POSTFIX: 275 295 case OT_POSTFIXASSIGN: … … 288 308 output << ")"; 289 309 break; 290 310 291 311 case OT_CONSTANT: 292 312 case OT_LABELADDRESS: … … 307 327 } // if 308 328 } 309 329 310 330 void CodeGenerator::visit( UntypedExpr *untypedExpr ) { 311 331 if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) { … … 321 341 output << "]"; 322 342 break; 323 343 324 344 case OT_CALL: 325 345 assert( false ); 326 346 break; 327 347 328 348 case OT_PREFIX: 329 349 case OT_PREFIXASSIGN: … … 335 355 output << ")"; 336 356 break; 337 357 338 358 case OT_POSTFIX: 339 359 case OT_POSTFIXASSIGN: … … 342 362 output << opInfo.symbol; 343 363 break; 344 364 345 365 case OT_INFIX: 346 366 case OT_INFIXASSIGN: … … 352 372 output << ")"; 353 373 break; 354 374 355 375 case OT_CONSTANT: 356 376 // there are no intrinsic definitions of 0 or 1 as functions … … 370 390 } // if 371 391 } 372 392 373 393 void CodeGenerator::visit( NameExpr *nameExpr ) { 374 394 OperatorInfo opInfo; … … 380 400 } // if 381 401 } 382 402 383 403 void CodeGenerator::visit( AddressExpr *addressExpr ) { 384 404 output << "(&"; … … 409 429 output << ")"; 410 430 } 411 431 412 432 void CodeGenerator::visit( UntypedMemberExpr *memberExpr ) { 413 433 assert( false ); 414 434 } 415 435 416 436 void CodeGenerator::visit( MemberExpr *memberExpr ) { 417 437 memberExpr->get_aggregate()->accept( *this ); 418 438 output << "." << mangleName( memberExpr->get_member() ); 419 439 } 420 440 421 441 void CodeGenerator::visit( VariableExpr *variableExpr ) { 422 442 OperatorInfo opInfo; … … 427 447 } // if 428 448 } 429 449 430 450 void CodeGenerator::visit( ConstantExpr *constantExpr ) { 431 451 assert( constantExpr->get_constant() ); 432 452 constantExpr->get_constant()->accept( *this ); 433 453 } 434 454 435 455 void CodeGenerator::visit( SizeofExpr *sizeofExpr ) { 436 456 output << "sizeof("; … … 469 489 assert( false && "OffsetPackExpr should not reach code generation" ); 470 490 } 471 491 472 492 void CodeGenerator::visit( LogicalExpr *logicalExpr ) { 473 493 output << "("; … … 481 501 output << ")"; 482 502 } 483 503 484 504 void CodeGenerator::visit( ConditionalExpr *conditionalExpr ) { 485 505 output << "("; … … 491 511 output << ")"; 492 512 } 493 513 494 514 void CodeGenerator::visit( CommaExpr *commaExpr ) { 495 515 output << "("; … … 499 519 output << ")"; 500 520 } 501 521 502 522 void CodeGenerator::visit( TupleExpr *tupleExpr ) {} 503 523 504 524 void CodeGenerator::visit( TypeExpr *typeExpr ) {} 505 525 … … 532 552 } 533 553 } 534 cur_indent -= CodeGenerator::tabsize; 554 cur_indent -= CodeGenerator::tabsize; 535 555 536 556 output << indent << "}"; … … 538 558 539 559 void CodeGenerator::visit( ExprStmt *exprStmt ) { 540 // I don't see why this check is necessary. 541 // If this starts to cause problems then put it back in, 560 // I don't see why this check is necessary. 561 // If this starts to cause problems then put it back in, 542 562 // with an explanation 543 563 assert( exprStmt ); … … 589 609 switchStmt->get_condition()->accept( *this ); 590 610 output << " ) "; 591 611 592 612 output << "{" << std::endl; 593 613 cur_indent += CodeGenerator::tabsize; … … 609 629 } // if 610 630 output << ":\n"; 611 631 612 632 std::list<Statement *> sts = caseStmt->get_statements(); 613 633 … … 626 646 if ( ! branchStmt->get_target().empty() ) 627 647 output << "goto " << branchStmt->get_target(); 628 else { 648 else { 629 649 if ( branchStmt->get_computedTarget() != 0 ) { 630 650 output << "goto *"; … … 677 697 678 698 void CodeGenerator::visit( ForStmt *forStmt ) { 679 // initialization is always hoisted, so don't 680 // bother doing anything with that 699 // initialization is always hoisted, so don't 700 // bother doing anything with that 681 701 output << "for (;"; 682 702 … … 702 722 void CodeGenerator::visit( DeclStmt *declStmt ) { 703 723 declStmt->get_decl()->accept( *this ); 704 724 705 725 if ( doSemicolon( declStmt->get_decl() ) ) { 706 726 output << ";"; -
TabularUnified src/InitTweak/module.mk ¶
rcb4c607 raf18713 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Rob Schluntz 13 ## Last Modified On : Mon Jan 11 14:40:16201613 ## Last Modified On : Wed May 04 16:03:49 2016 14 14 ## Update Count : 2 15 15 ############################################################################### 16 16 17 SRC += InitTweak/RemoveInit.cc 17 SRC += InitTweak/RemoveInit.cc \ 18 InitTweak/FixGlobalInit.cc 18 19 -
TabularUnified src/Makefile.in ¶
rcb4c607 raf18713 124 124 GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT) \ 125 125 InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT) \ 126 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) \ 126 127 Parser/driver_cfa_cpp-parser.$(OBJEXT) \ 127 128 Parser/driver_cfa_cpp-lex.$(OBJEXT) \ … … 346 347 GenPoly/CopyParams.cc GenPoly/FindFunction.cc \ 347 348 GenPoly/DeclMutator.cc InitTweak/RemoveInit.cc \ 348 Parser/parser.yy Parser/lex.ll Parser/TypedefTable.cc \ 349 Parser/ParseNode.cc Parser/DeclarationNode.cc \ 350 Parser/ExpressionNode.cc Parser/StatementNode.cc \ 351 Parser/InitializerNode.cc Parser/TypeData.cc \ 352 Parser/LinkageSpec.cc Parser/parseutility.cc Parser/Parser.cc \ 349 InitTweak/FixGlobalInit.cc Parser/parser.yy Parser/lex.ll \ 350 Parser/TypedefTable.cc Parser/ParseNode.cc \ 351 Parser/DeclarationNode.cc Parser/ExpressionNode.cc \ 352 Parser/StatementNode.cc Parser/InitializerNode.cc \ 353 Parser/TypeData.cc Parser/LinkageSpec.cc \ 354 Parser/parseutility.cc Parser/Parser.cc \ 353 355 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 354 356 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 562 564 @: > InitTweak/$(DEPDIR)/$(am__dirstamp) 563 565 InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT): \ 566 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp) 567 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT): \ 564 568 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp) 565 569 Parser/parser.h: Parser/parser.cc … … 792 796 -rm -f GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT) 793 797 -rm -f GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT) 798 -rm -f InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) 794 799 -rm -f InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT) 795 800 -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT) … … 897 902 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po@am__quote@ 898 903 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po@am__quote@ 904 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po@am__quote@ 899 905 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-RemoveInit.Po@am__quote@ 900 906 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po@am__quote@ … … 1380 1386 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-RemoveInit.obj `if test -f 'InitTweak/RemoveInit.cc'; then $(CYGPATH_W) 'InitTweak/RemoveInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/RemoveInit.cc'; fi` 1381 1387 1388 InitTweak/driver_cfa_cpp-FixGlobalInit.o: InitTweak/FixGlobalInit.cc 1389 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc 1390 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po 1391 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.o' libtool=no @AMDEPBACKSLASH@ 1392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1393 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc 1394 1395 InitTweak/driver_cfa_cpp-FixGlobalInit.obj: InitTweak/FixGlobalInit.cc 1396 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi` 1397 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po 1398 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.obj' libtool=no @AMDEPBACKSLASH@ 1399 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1400 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi` 1401 1382 1402 Parser/driver_cfa_cpp-parser.o: Parser/parser.cc 1383 1403 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parser.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo -c -o Parser/driver_cfa_cpp-parser.o `test -f 'Parser/parser.cc' || echo '$(srcdir)/'`Parser/parser.cc -
TabularUnified src/SynTree/Declaration.h ¶
rcb4c607 raf18713 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Declaration.h -- 7 // Declaration.h -- 8 8 // 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 : Wed Mar 2 17:28:11201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 15:39:02 2016 13 13 // Update Count : 33 14 14 // … … 106 106 typedef DeclarationWithType Parent; 107 107 public: 108 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ); 108 // temporary - merge this into general GCC attributes 109 struct Attribute { 110 enum Type { 111 NoAttribute, Constructor, Destructor, 112 } type; 113 enum Priority { 114 // priorities 0-100 are reserved by gcc, so it's okay to use 100 an exceptional case 115 Default = 100, High, 116 } priority; 117 Attribute(Type t = NoAttribute, Priority p = Default) : type(t), priority(p) {}; 118 }; 119 120 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute = Attribute() ); 109 121 FunctionDecl( const FunctionDecl &other ); 110 122 virtual ~FunctionDecl(); … … 119 131 std::list< std::string >& get_oldIdents() { return oldIdents; } 120 132 std::list< Declaration* >& get_oldDecls() { return oldDecls; } 133 Attribute get_attribute() const { return attribute; } 134 void set_attribute( Attribute newValue ) { attribute = newValue; } 121 135 122 136 virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } … … 130 144 std::list< std::string > oldIdents; 131 145 std::list< Declaration* > oldDecls; 146 Attribute attribute; 132 147 }; 133 148 -
TabularUnified src/SynTree/FunctionDecl.cc ¶
rcb4c607 raf18713 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FunctionDecl.cc -- 7 // FunctionDecl.cc -- 8 8 // 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 : Mon Jul 13 18:11:44 201511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 15:41:05 2016 13 13 // Update Count : 19 14 14 // … … 21 21 #include "Common/utility.h" 22 22 23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn )24 : Parent( name, sc, linkage ), type( type ), statements( statements ) {23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute ) 24 : Parent( name, sc, linkage ), type( type ), statements( statements ), attribute( attribute ) { 25 25 set_isInline( isInline ); 26 26 set_isNoreturn( isNoreturn ); … … 32 32 33 33 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), attribute( other.attribute ) { 35 35 } 36 36 … … 52 52 using std::endl; 53 53 using std::string; 54 54 55 55 if ( get_name() != "" ) { 56 56 os << get_name() << ": "; … … 65 65 os << "_Noreturn "; 66 66 } // if 67 switch ( attribute.type ) { 68 case Attribute::Constructor: 69 os << "Global Constructor "; 70 break; 71 case Attribute::Destructor: 72 os << "Global Destructor "; 73 break; 74 default: 75 break; 76 } 77 if ( attribute.priority != Attribute::Default ) { 78 os << "with priority " << attribute.priority << " "; 79 } 67 80 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 68 81 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; … … 94 107 using std::endl; 95 108 using std::string; 96 109 97 110 if ( get_name() != "" ) { 98 111 os << get_name() << ": "; … … 104 117 os << "_Noreturn "; 105 118 } // if 119 switch ( attribute.type ) { 120 case Attribute::Constructor: 121 os << " Global Constructor "; 122 break; 123 case Attribute::Destructor: 124 os << " Global Destructor "; 125 break; 126 default: 127 break; 128 } 129 if ( attribute.priority != Attribute::Default ) { 130 os << "with priority " << attribute.priority << " "; 131 } 106 132 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 107 133 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; -
TabularUnified src/driver/cc1.cc ¶
rcb4c607 raf18713 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 4 23:29:19201613 // Update Count : 7 412 // Last Modified On : Thu May 5 16:04:30 2016 13 // Update Count : 77 14 14 // 15 15 … … 323 323 cargs[0] = ( *new string( bprefix + "/cfa-cpp" ) ).c_str(); 324 324 325 // Source file-name without suffix used to generate routine names containing external initializations for TU. 326 string filename( cpp_in ); 327 string::size_type posn = filename.find_last_of( "/" ); 328 if ( posn != string::npos ) { 329 filename = filename.substr( posn + 1 ); 330 } // if 331 posn = filename.find_last_of( "." ); 332 if ( posn != string::npos ) { 333 filename = filename.substr( 0, posn ); 334 } // if 325 // Source file-name used to generate routine names containing global initializations for TU. 335 326 cargs[ncargs] = ( *new string( "-F" ) ).c_str(); 336 327 ncargs += 1; 337 cargs[ncargs] = ( *new string( filename) ).c_str();328 cargs[ncargs] = ( *new string( string( cpp_in ) ) ).c_str(); 338 329 ncargs += 1; 339 330 -
TabularUnified src/main.cc ¶
rcb4c607 raf18713 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:59201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 15:29:42 2016 13 13 // Update Count : 203 14 14 // … … 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" … … 98 99 int long_index; 99 100 std::list< Declaration * > translationUnit; 100 const char *filename = NULL; ;101 const char *filename = NULL; 101 102 102 103 opterr = 0; // prevent getopt from printing error messages 103 104 104 105 int c; 105 106 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:F:", long_opts, &long_index )) != -1 ) { … … 180 181 input = fopen( argv[ optind ], "r" ); 181 182 if ( ! input ) { 182 std::cout << "Error: can't open " << argv[ optind] << std::endl;183 std::cout << "Error: can't open " << argv[ optind ] << std::endl; 183 184 exit( 1 ); 184 185 } // if 186 // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to) 187 if ( filename == NULL ) filename = argv[ optind ]; 188 // prelude filename comes in differently 189 if ( libcfap ) filename = "prelude.cf"; 185 190 optind += 1; 186 191 } else { … … 191 196 output = new ofstream( argv[ optind ] ); 192 197 } // if 193 198 194 199 Parser::get_parser().set_debug( grammarp ); 195 200 … … 212 217 exit( 1 ); 213 218 } // if 214 219 215 220 parse( prelude, LinkageSpec::Intrinsic ); 216 221 } // if 217 222 } // if 218 223 219 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 220 224 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 225 221 226 if ( parsep ) { 222 227 Parser::get_parser().get_parseTree()->printList( std::cout ); … … 253 258 OPTPRINT( "mutate" ) 254 259 ControlStruct::mutate( translationUnit ); 255 OPTPRINT( "fixNames" ) 260 OPTPRINT( "fixNames" ) 256 261 CodeGen::fixNames( translationUnit ); 262 OPTPRINT( "fixGlobalInit" ); 263 InitTweak::fixGlobalInit( translationUnit, filename, libcfap || treep ); 257 264 OPTPRINT( "tweak" ) 258 265 InitTweak::tweak( translationUnit ); … … 282 289 OPTPRINT( "box" ) 283 290 GenPoly::box( translationUnit ); 284 291 285 292 // print tree right before code generation 286 293 if ( codegenp ) { … … 338 345 std::list< Declaration * > decls; 339 346 if ( noprotop ) { 340 filter( translationUnit.begin(), translationUnit.end(), 347 filter( translationUnit.begin(), translationUnit.end(), 341 348 std::back_inserter( decls ), notPrelude ); 342 349 } else {
Note: See TracChangeset
for help on using the changeset viewer.