Changeset fbcde64
- Timestamp:
- Mar 30, 2017, 5:21:07 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:
- 936a287
- Parents:
- 89ae7f4
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r89ae7f4 rfbcde64 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/Parser/ExpressionNode.cc
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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
r89ae7f4 rfbcde64 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 }
Note: See TracChangeset
for help on using the changeset viewer.