Changeset cff1143
- Timestamp:
- Jul 9, 2015, 3:07:32 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, string, with_gc
- Children:
- 0215a76f, dfee306
- Parents:
- 82dd287 (diff), e5609dd (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
-
src/CodeGen/GenType.cc
r82dd287 rcff1143 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 Jun 8 14:36:02201513 // Update Count : 911 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jul 08 16:08:24 2015 13 // Update Count : 10 14 14 // 15 15 … … 93 93 os << "_Atomic "; 94 94 } // if 95 if ( isVarLen ) {96 os << "*";97 } // if98 95 if ( dimension != 0 ) { 99 96 CodeGenerator cg( os ); 100 97 dimension->accept( cg ); 98 } else if ( isVarLen ) { 99 // no dimension expression on a VLA 100 // means it came in with the * token 101 os << "*"; 101 102 } // if 102 103 os << "]"; -
src/ControlStruct/LabelFixer.cc
r82dd287 rcff1143 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Ju n 24 16:24:34201513 // Update Count : 14 112 // Last Modified On : Wed Jul 08 12:36:46 2015 13 // Update Count : 145 14 14 // 15 15 … … 61 61 62 62 void LabelFixer::visit( FunctionDecl *functionDecl ) { 63 // need to go into a nested function in a fresh state 64 std::map < Label, Entry *> oldLabelTable = labelTable; 65 labelTable.clear(); 66 63 67 maybeAccept( functionDecl->get_statements(), *this ); 64 68 65 69 MLEMutator mlemut( resolveJumps(), generator ); 66 70 functionDecl->acceptMutator( mlemut ); 71 72 // and remember the outer function's labels when 73 // returning to it 74 labelTable = oldLabelTable; 67 75 } 68 76 -
src/Makefile.in
r82dd287 rcff1143 160 160 SymTab/cfa_cpp-FixFunction.$(OBJEXT) \ 161 161 SymTab/cfa_cpp-ImplementationType.$(OBJEXT) \ 162 SymTab/cfa_cpp-TypeEquality.$(OBJEXT) \ 162 163 SynTree/cfa_cpp-Type.$(OBJEXT) \ 163 164 SynTree/cfa_cpp-VoidType.$(OBJEXT) \ … … 365 366 SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \ 366 367 SymTab/FixFunction.cc SymTab/ImplementationType.cc \ 367 SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \ 368 SynTree/PointerType.cc SynTree/ArrayType.cc \ 369 SynTree/FunctionType.cc SynTree/ReferenceToType.cc \ 370 SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \ 371 SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \ 368 SymTab/TypeEquality.cc SynTree/Type.cc SynTree/VoidType.cc \ 369 SynTree/BasicType.cc SynTree/PointerType.cc \ 370 SynTree/ArrayType.cc SynTree/FunctionType.cc \ 371 SynTree/ReferenceToType.cc SynTree/TupleType.cc \ 372 SynTree/TypeofType.cc SynTree/AttrType.cc SynTree/Constant.cc \ 373 SynTree/Expression.cc SynTree/TupleExpr.cc \ 372 374 SynTree/CommaExpr.cc SynTree/TypeExpr.cc \ 373 375 SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \ … … 666 668 SymTab/cfa_cpp-ImplementationType.$(OBJEXT): SymTab/$(am__dirstamp) \ 667 669 SymTab/$(DEPDIR)/$(am__dirstamp) 670 SymTab/cfa_cpp-TypeEquality.$(OBJEXT): SymTab/$(am__dirstamp) \ 671 SymTab/$(DEPDIR)/$(am__dirstamp) 668 672 SynTree/$(am__dirstamp): 669 673 @$(MKDIR_P) SynTree … … 823 827 -rm -f SymTab/cfa_cpp-Indexer.$(OBJEXT) 824 828 -rm -f SymTab/cfa_cpp-Mangler.$(OBJEXT) 829 -rm -f SymTab/cfa_cpp-TypeEquality.$(OBJEXT) 825 830 -rm -f SymTab/cfa_cpp-Validate.$(OBJEXT) 826 831 -rm -f SynTree/cfa_cpp-AddressExpr.$(OBJEXT) … … 931 936 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/cfa_cpp-Indexer.Po@am__quote@ 932 937 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/cfa_cpp-Mangler.Po@am__quote@ 938 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Po@am__quote@ 933 939 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/cfa_cpp-Validate.Po@am__quote@ 934 940 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/cfa_cpp-AddressExpr.Po@am__quote@ … … 1910 1916 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1911 1917 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/cfa_cpp-ImplementationType.obj `if test -f 'SymTab/ImplementationType.cc'; then $(CYGPATH_W) 'SymTab/ImplementationType.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/ImplementationType.cc'; fi` 1918 1919 SymTab/cfa_cpp-TypeEquality.o: SymTab/TypeEquality.cc 1920 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/cfa_cpp-TypeEquality.o -MD -MP -MF SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Tpo -c -o SymTab/cfa_cpp-TypeEquality.o `test -f 'SymTab/TypeEquality.cc' || echo '$(srcdir)/'`SymTab/TypeEquality.cc 1921 @am__fastdepCXX_TRUE@ $(am__mv) SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Tpo SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Po 1922 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SymTab/TypeEquality.cc' object='SymTab/cfa_cpp-TypeEquality.o' libtool=no @AMDEPBACKSLASH@ 1923 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1924 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/cfa_cpp-TypeEquality.o `test -f 'SymTab/TypeEquality.cc' || echo '$(srcdir)/'`SymTab/TypeEquality.cc 1925 1926 SymTab/cfa_cpp-TypeEquality.obj: SymTab/TypeEquality.cc 1927 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/cfa_cpp-TypeEquality.obj -MD -MP -MF SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Tpo -c -o SymTab/cfa_cpp-TypeEquality.obj `if test -f 'SymTab/TypeEquality.cc'; then $(CYGPATH_W) 'SymTab/TypeEquality.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TypeEquality.cc'; fi` 1928 @am__fastdepCXX_TRUE@ $(am__mv) SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Tpo SymTab/$(DEPDIR)/cfa_cpp-TypeEquality.Po 1929 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SymTab/TypeEquality.cc' object='SymTab/cfa_cpp-TypeEquality.obj' libtool=no @AMDEPBACKSLASH@ 1930 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1931 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/cfa_cpp-TypeEquality.obj `if test -f 'SymTab/TypeEquality.cc'; then $(CYGPATH_W) 'SymTab/TypeEquality.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TypeEquality.cc'; fi` 1912 1932 1913 1933 SynTree/cfa_cpp-Type.o: SynTree/Type.cc -
src/Parser/DeclarationNode.cc
r82dd287 rcff1143 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 3 12:35:02201513 // Update Count : 1 0811 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jul 08 16:40:37 2015 13 // Update Count : 121 14 14 // 15 15 … … 284 284 newnode->type->array->dimension = size; 285 285 newnode->type->array->isStatic = isStatic; 286 newnode->type->array->isVarLen = false; 286 if ( newnode->type->array->dimension == 0 || dynamic_cast<ConstantNode *>( newnode->type->array->dimension ) ) { 287 newnode->type->array->isVarLen = false; 288 } else { 289 newnode->type->array->isVarLen = true; 290 } // if 287 291 return newnode->addQualifiers( qualifiers ); 288 292 } … … 464 468 bitfieldWidth = o->bitfieldWidth; 465 469 } // if 470 471 // there may be typedefs chained onto the type 472 if ( o->get_link() ) { 473 set_link( o->get_link()->clone() ); 474 } 475 466 476 } // if 467 477 delete o; -
src/Parser/ParseNode.cc
r82dd287 rcff1143 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:26:29 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jun 6 20:17:58201513 // Update Count : 2 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jul 08 14:46:45 2015 13 // Update Count : 25 14 14 // 15 15 … … 41 41 42 42 ParseNode *ParseNode::set_link( ParseNode *next_ ) { 43 ParseNode *follow;44 45 43 if ( next_ == 0 ) return this; 46 44 47 for ( follow = this; follow->next != 0; follow = follow->next ); 48 follow->next = next_; 45 get_last()->next = next_; 49 46 50 47 return this; -
src/SymTab/Validate.cc
r82dd287 rcff1143 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Jul 07 10:41:23201513 // Update Count : 1 3612 // Last Modified On : Wed Jul 08 12:49:36 2015 13 // Update Count : 166 14 14 // 15 15 … … 48 48 #include "Indexer.h" 49 49 #include "FixFunction.h" 50 #include "ImplementationType.h"50 // #include "ImplementationType.h" 51 51 #include "utility.h" 52 52 #include "UniqueName.h" 53 53 #include "AddVisit.h" 54 54 #include "MakeLibCfa.h" 55 55 #include "TypeEquality.h" 56 56 57 57 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } … … 162 162 class EliminateTypedef : public Mutator { 163 163 public: 164 EliminateTypedef() : scopeLevel( 0 ) {} 164 165 static void eliminateTypedef( std::list< Declaration * > &translationUnit ); 165 166 private: … … 171 172 virtual Type *mutate( TypeInstType *aggregateUseType ); 172 173 virtual Expression *mutate( CastExpr *castExpr ); 173 174 std::map< std::string, TypedefDecl * > typedefNames; 174 175 typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap; 176 TypedefMap typedefNames; 177 int scopeLevel; 175 178 }; 176 179 … … 589 592 assignDecl2->fixUniqueId(); 590 593 594 // these should be built in the same way that the prelude 595 // functions are, so build a list containing the prototypes 596 // and allow MakeLibCfa to autogenerate the bodies. 591 597 std::list< Declaration * > assigns; 592 598 assigns.push_back( assignDecl ); … … 595 601 LibCfa::makeLibCfa( assigns ); 596 602 597 // need to remove the prototypes, since th ese can appearnested in a routine603 // need to remove the prototypes, since this may be nested in a routine 598 604 for (int start = 0, end = assigns.size()/2; start < end; start++) { 599 605 delete assigns.front(); … … 602 608 603 609 declsToAdd.insert( declsToAdd.begin(), assigns.begin(), assigns.end() ); 604 605 // return assignDecl;606 610 } 607 611 … … 802 806 803 807 Type *EliminateTypedef::mutate( TypeInstType *typeInst ) { 804 std::map< std::string, TypedefDecl * >::const_iterator def = typedefNames.find( typeInst->get_name() ); 808 // instances of typedef types will come here. If it is an instance 809 // of a typdef type, link the instance to its actual type. 810 TypedefMap::const_iterator def = typedefNames.find( typeInst->get_name() ); 805 811 if ( def != typedefNames.end() ) { 806 Type *ret = def->second ->get_base()->clone();812 Type *ret = def->second.first->get_base()->clone(); 807 813 ret->get_qualifiers() += typeInst->get_qualifiers(); 808 814 delete typeInst; … … 814 820 Declaration *EliminateTypedef::mutate( TypedefDecl *tyDecl ) { 815 821 Declaration *ret = Mutator::mutate( tyDecl ); 816 typedefNames[ tyDecl->get_name() ] = tyDecl; 822 if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) { 823 // typedef to the same name from the same scope 824 // must be from the same type 825 826 Type * t1 = tyDecl->get_base(); 827 Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base(); 828 if ( ! typeEquals( t1, t2, true ) ) { 829 throw SemanticError( "cannot redefine typedef: " + tyDecl->get_name() ); 830 } 831 } else { 832 typedefNames[ tyDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel ); 833 } // if 834 817 835 // When a typedef is a forward declaration: 818 836 // typedef struct screen SCREEN; … … 833 851 834 852 TypeDecl *EliminateTypedef::mutate( TypeDecl *typeDecl ) { 835 std::map< std::string, TypedefDecl * >::iterator i = typedefNames.find( typeDecl->get_name() );853 TypedefMap::iterator i = typedefNames.find( typeDecl->get_name() ); 836 854 if ( i != typedefNames.end() ) { 837 855 typedefNames.erase( i ) ; … … 841 859 842 860 DeclarationWithType *EliminateTypedef::mutate( FunctionDecl *funcDecl ) { 843 std::map< std::string, TypedefDecl * >oldNames = typedefNames;861 TypedefMap oldNames = typedefNames; 844 862 DeclarationWithType *ret = Mutator::mutate( funcDecl ); 845 863 typedefNames = oldNames; … … 848 866 849 867 ObjectDecl *EliminateTypedef::mutate( ObjectDecl *objDecl ) { 850 std::map< std::string, TypedefDecl * >oldNames = typedefNames;868 TypedefMap oldNames = typedefNames; 851 869 ObjectDecl *ret = Mutator::mutate( objDecl ); 852 870 typedefNames = oldNames; … … 855 873 856 874 Expression *EliminateTypedef::mutate( CastExpr *castExpr ) { 857 std::map< std::string, TypedefDecl * >oldNames = typedefNames;875 TypedefMap oldNames = typedefNames; 858 876 Expression *ret = Mutator::mutate( castExpr ); 859 877 typedefNames = oldNames; … … 862 880 863 881 CompoundStmt *EliminateTypedef::mutate( CompoundStmt *compoundStmt ) { 864 std::map< std::string, TypedefDecl * > oldNames = typedefNames; 882 TypedefMap oldNames = typedefNames; 883 scopeLevel += 1; 865 884 CompoundStmt *ret = Mutator::mutate( compoundStmt ); 885 scopeLevel -= 1; 866 886 std::list< Statement * >::iterator i = compoundStmt->get_kids().begin(); 867 887 while ( i != compoundStmt->get_kids().end() ) { -
src/SymTab/module.mk
r82dd287 rcff1143 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Mon Jun 1 17:53:50201514 ## Update Count : 112 ## Last Modified By : Rob Schluntz 13 ## Last Modified On : Tue Jul 07 16:22:23 2015 14 ## Update Count : 2 15 15 ############################################################################### 16 16 … … 20 20 SymTab/Validate.cc \ 21 21 SymTab/FixFunction.cc \ 22 SymTab/ImplementationType.cc 23 22 SymTab/ImplementationType.cc \ 23 SymTab/TypeEquality.cc
Note: See TracChangeset
for help on using the changeset viewer.