Changeset d63eeb0 for src/SymTab
- Timestamp:
- Feb 9, 2016, 3:25:05 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:
- 7528ba1
- Parents:
- 771b3c3 (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
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/FixFunction.cc
r771b3c3 rd63eeb0 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
r771b3c3 rd63eeb0 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
r771b3c3 rd63eeb0 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
r771b3c3 rd63eeb0 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
r771b3c3 rd63eeb0 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
r771b3c3 rd63eeb0 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : T hu Jan 07 11:27:49201613 // Update Count : 2 6912 // Last Modified On : Tue Feb 09 13:21:56 2016 13 // Update Count : 270 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" … … 599 599 } 600 600 601 template< typename OutputIterator > 602 void makeUnionFieldsAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, UnionInstType *unionType, OutputIterator out ) { 603 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) ); 604 copy->get_args().push_back( new VariableExpr( dstParam ) ); 605 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) ); 606 copy->get_args().push_back( new SizeofExpr( unionType ) ); 607 608 *out++ = new ExprStmt( noLabels, copy ); 609 } 610 601 611 //E ?=?(E volatile*, int), 602 612 // ?=?(E _Atomic volatile*, int); … … 667 677 668 678 // Make function polymorphic in same parameters as generic struct, if applicable 679 bool isGeneric = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for union) 669 680 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 670 681 std::list< Expression* > structParams; // List of matching parameters to put on types 671 682 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 683 isGeneric = true; 672 684 TypeDecl *typeParam = (*param)->clone(); 673 685 assignType->get_forall().push_back( typeParam ); … … 675 687 } 676 688 677 ObjectDecl *returnVal = new ObjectDecl( " ", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 );689 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 ); 678 690 assignType->get_returnVals().push_back( returnVal ); 679 691 … … 705 717 if ( ArrayType *array = dynamic_cast< ArrayType * >( dwt->get_type() ) ) { 706 718 makeArrayAssignment( srcParam, dstParam, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) ); 719 if ( isGeneric ) makeArrayAssignment( srcParam, returnVal, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) ); 707 720 } else { 708 721 makeScalarAssignment( srcParam, dstParam, dwt, back_inserter( assignDecl->get_statements()->get_kids() ) ); 722 if ( isGeneric ) makeScalarAssignment( srcParam, returnVal, dwt, back_inserter( assignDecl->get_statements()->get_kids() ) ); 709 723 } // if 710 724 } // if 711 725 } // for 712 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );726 if ( ! isGeneric ) assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 713 727 714 728 return assignDecl; … … 719 733 720 734 // Make function polymorphic in same parameters as generic union, if applicable 735 bool isGeneric = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 721 736 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 722 737 std::list< Expression* > unionParams; // List of matching parameters to put on types 723 738 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 739 isGeneric = true; 724 740 TypeDecl *typeParam = (*param)->clone(); 725 741 assignType->get_forall().push_back( typeParam ); … … 727 743 } 728 744 729 ObjectDecl *returnVal = new ObjectDecl( " ", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 );745 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 ); 730 746 assignType->get_returnVals().push_back( returnVal ); 731 747 … … 741 757 assignDecl->fixUniqueId(); 742 758 743 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) ); 744 copy->get_args().push_back( new VariableExpr( dstParam ) ); 745 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) ); 746 copy->get_args().push_back( new SizeofExpr( cloneWithParams( refType, unionParams ) ) ); 747 748 assignDecl->get_statements()->get_kids().push_back( new ExprStmt( noLabels, copy ) ); 749 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 759 makeUnionFieldsAssignment( srcParam, dstParam, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) ); 760 if ( isGeneric ) makeUnionFieldsAssignment( srcParam, returnVal, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) ); 761 762 if ( ! isGeneric ) assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 750 763 751 764 return assignDecl;
Note: See TracChangeset
for help on using the changeset viewer.