Changes in / [32a1e5fd:830c21a]
- Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r32a1e5fd r830c21a 258 258 259 259 case OT_CALL: 260 // there are no intrinsic definitions of the function call operator 260 case OT_CTOR: 261 case OT_DTOR: 262 // there are no intrinsic definitions of the function call operator or constructors or destructors 261 263 assert( false ); 262 264 break; -
src/CodeGen/OperatorTable.cc
r32a1e5fd r830c21a 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 : Tue Jun 23 17:41:14 201513 // Update Count : 511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jun 24 16:17:34 2015 13 // Update Count : 7 14 14 // 15 15 … … 21 21 const OperatorInfo tableValues[] = { 22 22 { "?[?]", "", "_operator_index", OT_INDEX }, 23 { "?{}", "", "_constructor", OT_CTOR }, 24 { "-?{}", "", "_destructor", OT_DTOR }, // -?{}, !?{}, $?{}, ??{}, ?destroy, ?delete 23 25 { "?()", "", "_operator_call", OT_CALL }, 24 26 { "?++", "++", "_operator_postincr", OT_POSTFIXASSIGN }, -
src/CodeGen/OperatorTable.h
r32a1e5fd r830c21a 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 : Tue Jun 23 16:09:27 201513 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jun 24 16:17:57 2015 13 // Update Count : 5 14 14 // 15 15 … … 22 22 enum OperatorType { 23 23 OT_INDEX, 24 OT_CTOR, 25 OT_DTOR, 24 26 OT_CALL, 25 27 OT_PREFIX, -
src/MakeLibCfa.cc
r32a1e5fd r830c21a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 10:33:33 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Ju n 26 16:52:59201513 // Update Count : 1 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Jul 03 18:11:37 2015 13 // Update Count : 18 14 14 // 15 15 … … 77 77 break; 78 78 } 79 case CodeGen::OT_CTOR: 80 case CodeGen::OT_DTOR: 79 81 case CodeGen::OT_CONSTANT: 80 82 case CodeGen::OT_LABELADDRESS: -
src/Parser/LinkageSpec.cc
r32a1e5fd r830c21a 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:22:09 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat May 16 13:23:21201513 // Update Count : 211 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:53:05 2015 13 // Update Count : 5 14 14 // 15 15 … … 79 79 } 80 80 81 82 bool LinkageSpec::isOverridable( Type t ) { 83 switch ( t ) { 84 case Intrinsic: 85 case AutoGen: 86 return true; 87 case Cforall: 88 case C: 89 case Compiler: 90 return false; 91 } 92 assert( false ); 93 return false; 94 } 95 81 96 bool LinkageSpec::isBuiltin( Type t ) { 82 97 switch ( t ) { -
src/Parser/LinkageSpec.h
r32a1e5fd r830c21a 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat May 16 13:26:14201513 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Aug 18 14:11:55 2015 13 // Update Count : 5 14 14 // 15 15 … … 34 34 static bool isGeneratable( Type ); 35 35 static bool isOverloadable( Type ); 36 static bool isOverridable( Type ); 36 37 static bool isBuiltin( Type ); 37 38 }; -
src/Parser/ParseNode.h
r32a1e5fd r830c21a 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 1 2 13:27:11201513 // Update Count : 17 212 // Last Modified On : Wed Aug 19 15:59:27 2015 13 // Update Count : 174 14 14 // 15 15 … … 180 180 Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, 181 181 ERAssn, OrAssn, Index, FieldSel, PFieldSel, Range, 182 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress 182 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress, 183 Ctor, Dtor, 183 184 }; 184 185 -
src/SymTab/IdTable.cc
r32a1e5fd r830c21a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 17:04:02 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun May 17 17:07:43201513 // Update Count : 3 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:47:58 2015 13 // Update Count : 38 14 14 // 15 15 … … 52 52 if ( decl->get_linkage() == LinkageSpec::C ) { 53 53 manglename = name; 54 } else if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) { 55 // mangle the name without including the appropriate suffix 56 // this will make it so that overridable routines are placed 57 // into the same "bucket" as their user defined versions. 58 manglename = Mangler::mangle( decl, false ); 54 59 } else { 55 60 manglename = Mangler::mangle( decl ); … … 64 69 std::stack< DeclEntry >& entry = it->second; 65 70 if ( ! entry.empty() && entry.top().second == scopeLevel ) { 71 // typesCompatible doesn't really do the right thing here. When checking compatibility of function types, 72 // we should ignore outermost pointer qualifiers, except _Atomic? 73 66 74 if ( decl->get_linkage() != LinkageSpec::C || ResolvExpr::typesCompatible( decl->get_type(), entry.top().first->get_type(), Indexer() ) ) { 67 75 FunctionDecl *newentry = dynamic_cast< FunctionDecl* >( decl ); 68 76 FunctionDecl *old = dynamic_cast< FunctionDecl* >( entry.top().first ); 69 if ( newentry && old && newentry->get_statements() && old->get_statements() ) { 70 throw SemanticError( "duplicate function definition for ", decl ); 77 if ( LinkageSpec::isOverridable( old->get_linkage() ) ) { 78 // new definition shadows the autogenerated one, even at the same scope 79 declTable[ manglename ].push( DeclEntry( decl, scopeLevel ) ); 80 } else if ( newentry && old && newentry->get_statements() && old->get_statements() ) { 81 throw SemanticError( "duplicate function definition for 1 ", decl ); 71 82 } else { 83 // two objects with the same mangled name defined in the same scope. 84 // both objects must be marked extern for this to be okay 72 85 ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( decl ); 73 86 ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( entry.top().first ); 74 if ( newobj && oldobj && newobj->get_ init() && oldobj->get_init()) {87 if ( newobj && oldobj && newobj->get_storageClass() != DeclarationNode::Extern && oldobj->get_storageClass() != DeclarationNode::Extern ) { 75 88 throw SemanticError( "duplicate definition for ", decl ); 76 89 } // if 77 90 } // if 78 91 } else { 79 throw SemanticError( "duplicate definition for ", decl ); 92 // C definitions with the same name but incompatible types 93 throw SemanticError( "duplicate definition for 2 ", decl ); 80 94 } // if 81 95 } else { … … 84 98 } // if 85 99 // ensure the set of routines with C linkage cannot be overloaded 100 // this ensures that no two declarations with the same unmangled name both have C linkage 86 101 for ( InnerTableType::iterator i = declTable.begin(); i != declTable.end(); ++i ) { 87 102 if ( ! i->second.empty() && i->second.top().first->get_linkage() == LinkageSpec::C && declTable.size() > 1 ) { -
src/SymTab/Mangler.cc
r32a1e5fd r830c21a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:40:29 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Jun 8 15:12:12201513 // Update Count : 811 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:52:24 2015 13 // Update Count : 19 14 14 // 15 15 … … 30 30 31 31 namespace SymTab { 32 Mangler::Mangler( ) : nextVarNum( 0 ), isTopLevel( true ) {32 Mangler::Mangler( bool mangleOverridable ) : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ) { 33 33 } 34 34 … … 41 41 nextVarNum = rhs.nextVarNum; 42 42 isTopLevel = rhs.isTopLevel; 43 mangleOverridable = rhs.mangleOverridable; 43 44 } 44 45 … … 59 60 mangleName << "__"; 60 61 maybeAccept( declaration->get_type(), *this ); 62 if ( mangleOverridable && LinkageSpec::isOverridable( declaration->get_linkage() ) ) { 63 // want to be able to override autogenerated and intrinsic routines, 64 // so they need a different name mangling 65 if ( declaration->get_linkage() == LinkageSpec::AutoGen ) { 66 mangleName << "autogen__"; 67 } else if ( declaration->get_linkage() == LinkageSpec::Intrinsic ) { 68 mangleName << "intrinsic__"; 69 } else { 70 // if we add another kind of overridable function, this has to change 71 assert( false ); 72 } // if 73 } 61 74 isTopLevel = wasTopLevel; 62 75 } … … 214 227 varNums[ (*i )->get_name() ] = std::pair< int, int >( nextVarNum++, (int )(*i )->get_kind() ); 215 228 for ( std::list< DeclarationWithType* >::iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) { 216 Mangler sub_mangler ;229 Mangler sub_mangler( mangleOverridable ); 217 230 sub_mangler.nextVarNum = nextVarNum; 218 231 sub_mangler.isTopLevel = false; -
src/SymTab/Mangler.h
r32a1e5fd r830c21a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:44:03 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Jun 8 14:47:14201513 // Update Count : 511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:48:46 2015 13 // Update Count : 14 14 14 // 15 15 … … 25 25 public: 26 26 template< typename SynTreeClass > 27 static std::string mangle( SynTreeClass *decl ); // interface to clients27 static std::string mangle( SynTreeClass *decl, bool mangleOverridable = true ); // interface to clients 28 28 29 29 /// using Visitor::visit; … … 50 50 int nextVarNum; 51 51 bool isTopLevel; 52 bool mangleOverridable; 52 53 53 Mangler( );54 Mangler( bool mangleOverridable ); 54 55 Mangler( const Mangler & ); 55 56 … … 61 62 62 63 template< typename SynTreeClass > 63 std::string Mangler::mangle( SynTreeClass *decl ) {64 Mangler mangler ;64 std::string Mangler::mangle( SynTreeClass *decl, bool mangleOverridable ) { 65 Mangler mangler( mangleOverridable ); 65 66 maybeAccept( decl, mangler ); 66 67 return mangler.get_mangleName();
Note: See TracChangeset
for help on using the changeset viewer.