Changeset 843054c2 for src/Parser
- Timestamp:
- May 21, 2015, 9:44:51 PM (7 years ago)
- Branches:
- aaron-thesis, arm-eh, 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, resolv-new, string, with_gc
- Children:
- 76f2e97f
- Parents:
- a08ba92
- Location:
- src/Parser
- Files:
-
- 20 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
ra08ba92 r843054c2 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 12:38:20201513 // Update Count : 412 // Last Modified On : Thu May 21 09:28:54 2015 13 // Update Count : 13 14 14 // 15 15 … … 751 751 newnode->type = ret; 752 752 return newnode; 753 } else { 754 return 0; 755 } 756 } else { 757 return 0; 758 } 753 } // if 754 } // if 755 return 0; 759 756 } 760 757 … … 770 767 if ( decl ) { 771 768 *out++ = decl; 772 } 773 } 769 } // if 770 } // if 774 771 Declaration *decl = cur->build(); 775 772 if ( decl ) { 776 773 *out++ = decl; 777 } 774 } // if 778 775 } catch( SemanticError &e ) { 779 776 errors.append( e ); 780 } 777 } // try 781 778 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 782 } 779 } // while 783 780 if ( ! errors.isEmpty() ) { 784 781 throw errors; 785 } 782 } // if 786 783 } 787 784 … … 811 808 UnionInstType *inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 812 809 *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 ); 813 } 814 } 810 } // if 811 } // if 815 812 } catch( SemanticError &e ) { 816 813 errors.append( e ); 817 } 814 } // try 818 815 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 819 } 816 } // while 820 817 if ( ! errors.isEmpty() ) { 821 818 throw errors; 822 } 819 } // if 823 820 } 824 821 … … 832 829 } catch( SemanticError &e ) { 833 830 errors.append( e ); 834 } 831 } // try 835 832 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 836 } 833 } // while 837 834 if ( ! errors.isEmpty() ) { 838 835 throw errors; 839 } 836 } // if 840 837 } 841 838 842 839 Declaration *DeclarationNode::build() const { 843 844 if ( ! type ) { 845 if ( buildInline() ) { 846 throw SemanticError( "invalid inline specification in declaration of ", this ); 847 } else { 848 return new ObjectDecl( name, buildStorageClass(), linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ); 849 } 850 } else { 840 if ( type ) { 851 841 Declaration *newDecl = type->buildDecl( name, buildStorageClass(), maybeBuild< Expression >( bitfieldWidth ), buildInline(), linkage, maybeBuild< Initializer >(initializer) ); 852 842 return newDecl; 853 } 854 // we should never get here 855 assert( false ); 856 return 0; 843 } // if 844 if ( ! buildInline() ) { 845 return new ObjectDecl( name, buildStorageClass(), linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ); 846 } // if 847 throw SemanticError( "invalid inline specification in declaration of ", this ); 857 848 } 858 849 … … 904 895 for ( std::list< StorageClass >::const_iterator i = storageClasses.begin(); i != storageClasses.end(); ++i ) { 905 896 assert( unsigned( *i ) < sizeof( scMap ) / sizeof( scMap[0] ) ); 906 if ( *i == Inline ) continue; 907 if ( ret == Declaration::NoStorageClass ) { 908 ret = scMap[ *i ]; 909 } else { 897 if ( *i == Inline ) continue; 898 if ( ret != Declaration::NoStorageClass ) { 910 899 throw SemanticError( "invalid combination of storage classes in declaration of ", this ); 911 900 } 901 ret = scMap[ *i ]; 912 902 } 913 903 return ret; … … 916 906 bool DeclarationNode::buildInline() const { 917 907 std::list< StorageClass >::const_iterator first = std::find( storageClasses.begin(), storageClasses.end(), Inline ); 918 if ( first == storageClasses.end() ) { 919 return false; 920 } else { 921 std::list< StorageClass >::const_iterator next = std::find( ++first, storageClasses.end(), Inline ); 922 if ( next == storageClasses.end() ) { 923 return true; 924 } else { 925 throw SemanticError( "duplicate inline specification in declaration of ", this ); 926 } 927 } 928 // we should never get here 929 return false; 908 if ( first == storageClasses.end() ) return false; 909 std::list< StorageClass >::const_iterator next = std::find( ++first, storageClasses.end(), Inline ); 910 if ( next == storageClasses.end() ) return true; 911 throw SemanticError( "duplicate inline specification in declaration of ", this ); 930 912 } 931 913 -
src/Parser/module.mk
ra08ba92 r843054c2 8 8 ## module.mk -- 9 9 ## 10 ## Author : Peter A. Buhr10 ## Author : Richard C. Bilson 11 11 ## Created On : Sat May 16 15:29:09 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat May 16 15:29:50201514 ## Update Count : 113 ## Last Modified On : Thu May 21 21:17:07 2015 14 ## Update Count : 2 15 15 ############################################################################### 16 16
Note: See TracChangeset
for help on using the changeset viewer.