- Timestamp:
- Mar 31, 2017, 12:21:52 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 78d3dd5
- Parents:
- 690f13c (diff), 936a287 (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:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r690f13c r72dc82a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:06:01 201713 // Update Count : 48 112 // Last Modified On : Thu Mar 30 16:38:01 2017 13 // Update Count : 482 14 14 // 15 15 … … 674 674 675 675 void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) { 676 assert( compLitExpr->get_ type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) );677 output << "(" << genType( compLitExpr->get_ type(), "", pretty ) << ")";676 assert( compLitExpr->get_result() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) ); 677 output << "(" << genType( compLitExpr->get_result(), "", pretty ) << ")"; 678 678 compLitExpr->get_initializer()->accept( *this ); 679 679 } -
src/InitTweak/FixInit.cc
r690f13c r72dc82a 738 738 stmtsToAddAfter.push_back( ifStmt ); 739 739 740 if ( ctorInit->get_dtor() ) { 740 Statement * dtor = ctorInit->get_dtor(); 741 objDecl->set_init( NULL ); 742 ctorInit->set_ctor( NULL ); 743 ctorInit->set_dtor( nullptr ); 744 if ( dtor ) { 741 745 // if the object has a non-trivial destructor, have to 742 746 // hoist it and the object into the global space and 743 747 // call the destructor function with atexit. 744 748 745 Statement * dtorStmt = ctorInit->get_dtor()->clone();749 Statement * dtorStmt = dtor->clone(); 746 750 747 751 // void __objName_dtor_atexitN(...) {...} … … 772 776 objDecl->set_mangleName( SymTab::Mangler::mangle( objDecl ) ); 773 777 774 objDecl->set_init( NULL );775 ctorInit->set_ctor( NULL );776 delete ctorInit;777 778 778 // xxx - temporary hack: need to return a declaration, but want to hoist the current object out of this scope 779 779 // create a new object which is never used 780 780 static UniqueName dummyNamer( "_dummy" ); 781 781 ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } ); 782 delete ctorInit; 782 783 return dummy; 783 784 } -
src/InitTweak/GenInit.cc
r690f13c r72dc82a 294 294 handleDWT( objDecl ); 295 295 // hands off if @=, extern, builtin, etc. 296 // if global but initializer is not constexpr, always try to construct, since this is not legal C297 if ( ( tryConstruct( objDecl ) && isManaged( objDecl ) ) || (! inFunction && ! isConstExpr( objDecl->get_init() ) ) ) {296 // even if unmanaged, try to construct global or static if initializer is not constexpr, since this is not legal C 297 if ( tryConstruct( objDecl ) && ( isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) { 298 298 // constructed objects cannot be designated 299 if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=. ", objDecl );299 if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n", objDecl ); 300 300 // constructed objects should not have initializers nested too deeply 301 301 if ( ! checkInitDepth( objDecl ) ) throw SemanticError( "Managed object's initializer is too deep ", objDecl ); -
src/Parser/ExpressionNode.cc
r690f13c r72dc82a 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Mar 4 06:58:47201713 // Update Count : 5 0912 // Last Modified On : Thu Mar 30 17:02:46 2017 13 // Update Count : 515 14 14 // 15 15 … … 356 356 // these types do not have associated type information 357 357 } else if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( newDecl ) ) { 358 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 358 if ( newDeclStructDecl->has_body() ) { 359 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl ), maybeMoveBuild< Initializer >(kids) ); 360 } else { 361 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 362 } // if 359 363 } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( newDecl ) ) { 360 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 364 if ( newDeclUnionDecl->has_body() ) { 365 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl ), maybeMoveBuild< Initializer >(kids) ); 366 } else { 367 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 368 } // if 361 369 } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( newDecl ) ) { 362 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 370 if ( newDeclEnumDecl->has_body() ) { 371 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl ), maybeMoveBuild< Initializer >(kids) ); 372 } else { 373 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 374 } // if 363 375 } else { 364 376 assert( false ); -
src/Parser/parser.yy
r690f13c r72dc82a 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 15:42:22 201713 // Update Count : 231 712 // Last Modified On : Thu Mar 30 15:42:32 2017 13 // Update Count : 2318 14 14 // 15 15 … … 423 423 | postfix_expression DECR 424 424 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, $1 ) ); } 425 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99 425 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal 426 426 { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); } 427 427 | postfix_expression '{' argument_expression_list '}' // CFA -
src/SymTab/Indexer.cc
r690f13c r72dc82a 10 10 // Created On : Sun May 17 21:37:33 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 14 08:07:34201713 // Update Count : 1 712 // Last Modified On : Thu Mar 30 16:38:47 2017 13 // Update Count : 19 14 14 // 15 15 … … 483 483 void Indexer::visit( CompoundLiteralExpr *compLitExpr ) { 484 484 acceptNewScope( compLitExpr->get_result(), *this ); 485 maybeAccept( compLitExpr->get_type(), *this );486 485 maybeAccept( compLitExpr->get_initializer(), *this ); 487 486 } -
src/SymTab/Validate.cc
r690f13c r72dc82a 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 16:39:15201713 // Update Count : 35 312 // Last Modified On : Thu Mar 30 16:50:13 2017 13 // Update Count : 357 14 14 // 15 15 … … 222 222 CompoundLiteral compoundliteral; 223 223 224 HoistStruct::hoistStruct( translationUnit ); 224 225 EliminateTypedef::eliminateTypedef( translationUnit ); 225 HoistStruct::hoistStruct( translationUnit );226 226 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 227 227 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions … … 824 824 static UniqueName indexName( "_compLit" ); 825 825 826 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_ type(), compLitExpr->get_initializer() );827 compLitExpr->set_ type( 0 );826 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_result(), compLitExpr->get_initializer() ); 827 compLitExpr->set_result( 0 ); 828 828 compLitExpr->set_initializer( 0 ); 829 829 delete compLitExpr; -
src/SynTree/Expression.cc
r690f13c r72dc82a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:42:04201713 // Update Count : 5 112 // Last Modified On : Thu Mar 30 16:41:13 2017 13 // Update Count : 52 14 14 // 15 15 … … 571 571 572 572 573 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ),initializer( initializer ) {573 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) { 574 574 assert( type && initializer ); 575 set_result( type ->clone());576 } 577 578 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( other.type->clone() ),initializer( other.initializer->clone() ) {}575 set_result( type ); 576 } 577 578 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {} 579 579 580 580 CompoundLiteralExpr::~CompoundLiteralExpr() { 581 581 delete initializer; 582 delete type;583 582 } 584 583 … … 586 585 os << "Compound Literal Expression: " << std::endl; 587 586 os << std::string( indent+2, ' ' ); 588 type->print( os, indent + 2 );587 get_result()->print( os, indent + 2 ); 589 588 os << std::string( indent+2, ' ' ); 590 589 initializer->print( os, indent + 2 ); -
src/SynTree/Expression.h
r690f13c r72dc82a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jan 14 14:37:54201713 // Update Count : 3712 // Last Modified On : Thu Mar 30 16:44:00 2017 13 // Update Count : 41 14 14 // 15 15 … … 35 35 36 36 Type *& get_result() { return result; } 37 const Type * get_result() const { return result; } 37 38 void set_result( Type * newValue ) { result = newValue; } 38 39 bool has_result() const { return result != nullptr; } … … 586 587 virtual ~CompoundLiteralExpr(); 587 588 588 Type * get_type() const { return type; }589 void set_type( Type * t ) { type = t; }590 591 589 Initializer * get_initializer() const { return initializer; } 592 590 void set_initializer( Initializer * i ) { initializer = i; } … … 597 595 virtual void print( std::ostream & os, int indent = 0 ) const; 598 596 private: 599 Type * type;600 597 Initializer * initializer; 601 598 }; -
src/SynTree/Mutator.cc
r690f13c r72dc82a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 16 15:02:23201713 // Update Count : 2 112 // Last Modified On : Thu Mar 30 16:45:19 2017 13 // Update Count : 22 14 14 // 15 15 … … 369 369 compLitExpr->set_env( maybeMutate( compLitExpr->get_env(), *this ) ); 370 370 compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) ); 371 compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) );372 371 compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) ); 373 372 return compLitExpr; -
src/SynTree/Visitor.cc
r690f13c r72dc82a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 16 15:01:25 201713 // Update Count : 2 312 // Last Modified On : Thu Mar 30 16:45:25 2017 13 // Update Count : 24 14 14 // 15 15 … … 292 292 void Visitor::visit( CompoundLiteralExpr *compLitExpr ) { 293 293 maybeAccept( compLitExpr->get_result(), *this ); 294 maybeAccept( compLitExpr->get_type(), *this );295 294 maybeAccept( compLitExpr->get_initializer(), *this ); 296 295 } -
src/libcfa/iostream.c
r690f13c r72dc82a 154 154 ostype * ?|?( ostype * os, const char * cp ) { 155 155 enum { Open = 1, Close, OpenClose }; 156 static const unsigned char mask[256] = {156 static const unsigned char mask[256] @= { 157 157 // opening delimiters, no space after 158 158 ['('] : Open, ['['] : Open, ['{'] : Open,
Note:
See TracChangeset
for help on using the changeset viewer.