Changeset d41280e for src/SymTab
- Timestamp:
- Feb 8, 2016, 10:07:42 AM (10 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:
- c44e622
- Parents:
- 00ede9e (diff), bd85400 (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/SymTab
- Files:
-
- 6 edited
-
FixFunction.cc (modified) (1 diff)
-
IdTable.cc (modified) (4 diffs)
-
ImplementationType.cc (modified) (1 diff)
-
Indexer.cc (modified) (2 diffs)
-
Indexer.h (modified) (1 diff)
-
Validate.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/FixFunction.cc
r00ede9e rd41280e 18 18 #include "SynTree/Type.h" 19 19 #include "SynTree/Expression.h" 20 #include " utility.h"20 #include "Common/utility.h" 21 21 22 22 namespace SymTab { -
src/SymTab/IdTable.cc
r00ede9e rd41280e 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 17:04:02 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Oct 07 12:21:13 201513 // Update Count : 7 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 8 22:59:23 2016 13 // Update Count : 74 14 14 // 15 15 … … 21 21 #include "Mangler.h" 22 22 #include "IdTable.h" 23 #include " SemanticError.h"23 #include "Common/SemanticError.h" 24 24 25 25 using std::string; … … 54 54 manglename = name; 55 55 } else if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) { 56 // mangle the name without including the appropriate suffix 57 // this will make it so that overridable routines are placed 58 // into the same "bucket" as their user defined versions. 56 // mangle the name without including the appropriate suffix, so overridable routines are placed into the 57 // same "bucket" as their user defined versions. 59 58 manglename = Mangler::mangle( decl, false ); 60 59 } else { … … 71 70 std::stack< DeclEntry >& entry = it->second; 72 71 if ( ! entry.empty() && entry.top().second == scopeLevel ) { 73 // if we're giving the same name mangling to things of 74 // different types then there is something wrong 72 // if we're giving the same name mangling to things of different types then there is something wrong 75 73 Declaration *old = entry.top().first; 76 74 assert( (dynamic_cast<ObjectDecl*>( decl ) && dynamic_cast<ObjectDecl*>( old ) ) -
src/SymTab/ImplementationType.cc
r00ede9e rd41280e 19 19 #include "SynTree/Visitor.h" 20 20 #include "SymTab/Indexer.h" 21 #include " utility.h"21 #include "Common/utility.h" 22 22 23 23 -
src/SymTab/Indexer.cc
r00ede9e rd41280e 21 21 #include "Indexer.h" 22 22 #include <typeinfo> 23 #include " utility.h"23 #include "Common/utility.h" 24 24 25 25 #define debugPrint(x) if ( doDebug ) { std::cout << x; } … … 225 225 maybeAccept( alignofExpr->get_expr(), *this ); 226 226 } 227 } 228 229 void Indexer::visit( UntypedOffsetofExpr *offsetofExpr ) { 230 acceptAllNewScope( offsetofExpr->get_results(), *this ); 231 maybeAccept( offsetofExpr->get_type(), *this ); 232 } 233 234 void Indexer::visit( OffsetofExpr *offsetofExpr ) { 235 acceptAllNewScope( offsetofExpr->get_results(), *this ); 236 maybeAccept( offsetofExpr->get_type(), *this ); 237 maybeAccept( offsetofExpr->get_member(), *this ); 227 238 } 228 239 -
src/SymTab/Indexer.h
r00ede9e rd41280e 55 55 virtual void visit( SizeofExpr *sizeofExpr ); 56 56 virtual void visit( AlignofExpr *alignofExpr ); 57 virtual void visit( UntypedOffsetofExpr *offsetofExpr ); 58 virtual void visit( OffsetofExpr *offsetofExpr ); 57 59 virtual void visit( AttrExpr *attrExpr ); 58 60 virtual void visit( LogicalExpr *logicalExpr ); -
src/SymTab/Validate.cc
r00ede9e rd41280e 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:50:04 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Dec 18 15:34:05 201513 // Update Count : 2 1811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 27 22:03:12 2016 13 // Update Count : 225 14 14 // 15 15 … … 49 49 #include "FixFunction.h" 50 50 // #include "ImplementationType.h" 51 #include " utility.h"52 #include " UniqueName.h"51 #include "Common/utility.h" 52 #include "Common/UniqueName.h" 53 53 #include "AddVisit.h" 54 54 #include "MakeLibCfa.h" … … 585 585 } 586 586 587 template< typename OutputIterator > 588 void makeUnionFieldsAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, UnionInstType *unionType, OutputIterator out ) { 589 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) ); 590 copy->get_args().push_back( new VariableExpr( dstParam ) ); 591 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) ); 592 copy->get_args().push_back( new SizeofExpr( unionType ) ); 593 594 *out++ = new ExprStmt( noLabels, copy ); 595 } 596 587 597 //E ?=?(E volatile*, int), 588 598 // ?=?(E _Atomic volatile*, int); … … 653 663 654 664 // Make function polymorphic in same parameters as generic struct, if applicable 665 bool isGeneric = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for union) 655 666 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 656 667 std::list< Expression* > structParams; // List of matching parameters to put on types 657 668 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 669 isGeneric = true; 658 670 TypeDecl *typeParam = (*param)->clone(); 659 671 assignType->get_forall().push_back( typeParam ); … … 661 673 } 662 674 663 ObjectDecl *returnVal = new ObjectDecl( " ", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 );675 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 ); 664 676 assignType->get_returnVals().push_back( returnVal ); 665 677 … … 691 703 if ( ArrayType *array = dynamic_cast< ArrayType * >( dwt->get_type() ) ) { 692 704 makeArrayAssignment( srcParam, dstParam, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) ); 705 if ( isGeneric ) makeArrayAssignment( srcParam, returnVal, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) ); 693 706 } else { 694 707 makeScalarAssignment( srcParam, dstParam, dwt, back_inserter( assignDecl->get_statements()->get_kids() ) ); 708 if ( isGeneric ) makeScalarAssignment( srcParam, returnVal, dwt, back_inserter( assignDecl->get_statements()->get_kids() ) ); 695 709 } // if 696 710 } // if 697 711 } // for 698 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );712 if ( ! isGeneric ) assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 699 713 700 714 return assignDecl; … … 705 719 706 720 // Make function polymorphic in same parameters as generic union, if applicable 721 bool isGeneric = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 707 722 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 708 723 std::list< Expression* > unionParams; // List of matching parameters to put on types 709 724 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 725 isGeneric = true; 710 726 TypeDecl *typeParam = (*param)->clone(); 711 727 assignType->get_forall().push_back( typeParam ); … … 713 729 } 714 730 715 ObjectDecl *returnVal = new ObjectDecl( " ", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 );731 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 ); 716 732 assignType->get_returnVals().push_back( returnVal ); 717 733 … … 727 743 assignDecl->fixUniqueId(); 728 744 729 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) ); 730 copy->get_args().push_back( new VariableExpr( dstParam ) ); 731 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) ); 732 copy->get_args().push_back( new SizeofExpr( cloneWithParams( refType, unionParams ) ) ); 733 734 assignDecl->get_statements()->get_kids().push_back( new ExprStmt( noLabels, copy ) ); 735 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 745 makeUnionFieldsAssignment( srcParam, dstParam, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) ); 746 if ( isGeneric ) makeUnionFieldsAssignment( srcParam, returnVal, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) ); 747 748 if ( ! isGeneric ) assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 736 749 737 750 return assignDecl;
Note:
See TracChangeset
for help on using the changeset viewer.