Changes in / [334ebc23:971ae89]
- Location:
- src
- Files:
-
- 10 edited
-
CodeGen/CodeGenerator.cc (modified) (1 diff)
-
CodeGen/OperatorTable.cc (modified) (2 diffs)
-
CodeGen/OperatorTable.h (modified) (2 diffs)
-
MakeLibCfa.cc (modified) (2 diffs)
-
Parser/LinkageSpec.cc (modified) (2 diffs)
-
Parser/LinkageSpec.h (modified) (2 diffs)
-
Parser/ParseNode.h (modified) (2 diffs)
-
SymTab/IdTable.cc (modified) (4 diffs)
-
SymTab/Mangler.cc (modified) (5 diffs)
-
SymTab/Mangler.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r334ebc23 r971ae89 258 258 259 259 case OT_CALL: 260 case OT_CTOR: 261 case OT_DTOR: 262 // there are no intrinsic definitions of the function call operator or constructors or destructors 260 // there are no intrinsic definitions of the function call operator 263 261 assert( false ); 264 262 break; -
src/CodeGen/OperatorTable.cc
r334ebc23 r971ae89 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Jun 24 16:17:34 201513 // Update Count : 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jun 23 17:41:14 2015 13 // Update Count : 5 14 14 // 15 15 … … 21 21 const OperatorInfo tableValues[] = { 22 22 { "?[?]", "", "_operator_index", OT_INDEX }, 23 { "?{}", "", "_constructor", OT_CTOR },24 { "-?{}", "", "_destructor", OT_DTOR }, // -?{}, !?{}, $?{}, ??{}, ?destroy, ?delete25 23 { "?()", "", "_operator_call", OT_CALL }, 26 24 { "?++", "++", "_operator_postincr", OT_POSTFIXASSIGN }, -
src/CodeGen/OperatorTable.h
r334ebc23 r971ae89 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Jun 24 16:17:57 201513 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jun 23 16:09:27 2015 13 // Update Count : 3 14 14 // 15 15 … … 22 22 enum OperatorType { 23 23 OT_INDEX, 24 OT_CTOR,25 OT_DTOR,26 24 OT_CALL, 27 25 OT_PREFIX, -
src/MakeLibCfa.cc
r334ebc23 r971ae89 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 10:33:33 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Ju l 03 18:11:37201513 // Update Count : 1 811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 26 16:52:59 2015 13 // Update Count : 14 14 14 // 15 15 … … 77 77 break; 78 78 } 79 case CodeGen::OT_CTOR:80 case CodeGen::OT_DTOR:81 79 case CodeGen::OT_CONSTANT: 82 80 case CodeGen::OT_LABELADDRESS: -
src/Parser/LinkageSpec.cc
r334ebc23 r971ae89 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:22:09 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Aug 19 15:53:05201513 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 13:23:21 2015 13 // Update Count : 2 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 96 81 bool LinkageSpec::isBuiltin( Type t ) { 97 82 switch ( t ) { -
src/Parser/LinkageSpec.h
r334ebc23 r971ae89 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Aug 18 14:11:55201513 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 13:26:14 2015 13 // Update Count : 3 14 14 // 15 15 … … 34 34 static bool isGeneratable( Type ); 35 35 static bool isOverloadable( Type ); 36 static bool isOverridable( Type );37 36 static bool isBuiltin( Type ); 38 37 }; -
src/Parser/ParseNode.h
r334ebc23 r971ae89 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 9 15:59:27201513 // Update Count : 17 412 // Last Modified On : Wed Aug 12 13:27:11 2015 13 // Update Count : 172 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, 183 Ctor, Dtor, 182 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress 184 183 }; 185 184 -
src/SymTab/IdTable.cc
r334ebc23 r971ae89 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 Aug 19 15:47:58201513 // Update Count : 3 811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 17 17:07:43 2015 13 // Update Count : 3 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 suffix56 // this will make it so that overridable routines are placed57 // into the same "bucket" as their user defined versions.58 manglename = Mangler::mangle( decl, false );59 54 } else { 60 55 manglename = Mangler::mangle( decl ); … … 69 64 std::stack< DeclEntry >& entry = it->second; 70 65 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 74 66 if ( decl->get_linkage() != LinkageSpec::C || ResolvExpr::typesCompatible( decl->get_type(), entry.top().first->get_type(), Indexer() ) ) { 75 67 FunctionDecl *newentry = dynamic_cast< FunctionDecl* >( decl ); 76 68 FunctionDecl *old = dynamic_cast< FunctionDecl* >( entry.top().first ); 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 ); 69 if ( newentry && old && newentry->get_statements() && old->get_statements() ) { 70 throw SemanticError( "duplicate function definition for ", decl ); 82 71 } 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 okay85 72 ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( decl ); 86 73 ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( entry.top().first ); 87 if ( newobj && oldobj && newobj->get_ storageClass() != DeclarationNode::Extern && oldobj->get_storageClass() != DeclarationNode::Extern) {74 if ( newobj && oldobj && newobj->get_init() && oldobj->get_init() ) { 88 75 throw SemanticError( "duplicate definition for ", decl ); 89 76 } // if 90 77 } // if 91 78 } else { 92 // C definitions with the same name but incompatible types 93 throw SemanticError( "duplicate definition for 2 ", decl ); 79 throw SemanticError( "duplicate definition for ", decl ); 94 80 } // if 95 81 } else { … … 98 84 } // if 99 85 // 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 linkage101 86 for ( InnerTableType::iterator i = declTable.begin(); i != declTable.end(); ++i ) { 102 87 if ( ! i->second.empty() && i->second.top().first->get_linkage() == LinkageSpec::C && declTable.size() > 1 ) { -
src/SymTab/Mangler.cc
r334ebc23 r971ae89 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:40:29 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Aug 19 15:52:24201513 // Update Count : 1911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 15:12:12 2015 13 // Update Count : 8 14 14 // 15 15 … … 30 30 31 31 namespace SymTab { 32 Mangler::Mangler( bool mangleOverridable ) : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ) {32 Mangler::Mangler() : nextVarNum( 0 ), isTopLevel( true ) { 33 33 } 34 34 … … 41 41 nextVarNum = rhs.nextVarNum; 42 42 isTopLevel = rhs.isTopLevel; 43 mangleOverridable = rhs.mangleOverridable;44 43 } 45 44 … … 60 59 mangleName << "__"; 61 60 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 mangling65 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 change71 assert( false );72 } // if73 }74 61 isTopLevel = wasTopLevel; 75 62 } … … 227 214 varNums[ (*i )->get_name() ] = std::pair< int, int >( nextVarNum++, (int )(*i )->get_kind() ); 228 215 for ( std::list< DeclarationWithType* >::iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) { 229 Mangler sub_mangler ( mangleOverridable );216 Mangler sub_mangler; 230 217 sub_mangler.nextVarNum = nextVarNum; 231 218 sub_mangler.isTopLevel = false; -
src/SymTab/Mangler.h
r334ebc23 r971ae89 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:44:03 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Aug 19 15:48:46201513 // Update Count : 1411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 14:47:14 2015 13 // Update Count : 5 14 14 // 15 15 … … 25 25 public: 26 26 template< typename SynTreeClass > 27 static std::string mangle( SynTreeClass *decl , bool mangleOverridable = true); // interface to clients27 static std::string mangle( SynTreeClass *decl ); // interface to clients 28 28 29 29 /// using Visitor::visit; … … 50 50 int nextVarNum; 51 51 bool isTopLevel; 52 bool mangleOverridable;53 52 54 Mangler( bool mangleOverridable);53 Mangler(); 55 54 Mangler( const Mangler & ); 56 55 … … 62 61 63 62 template< typename SynTreeClass > 64 std::string Mangler::mangle( SynTreeClass *decl , bool mangleOverridable) {65 Mangler mangler ( mangleOverridable );63 std::string Mangler::mangle( SynTreeClass *decl ) { 64 Mangler mangler; 66 65 maybeAccept( decl, mangler ); 67 66 return mangler.get_mangleName();
Note:
See TracChangeset
for help on using the changeset viewer.