Changes in src/SymTab/Indexer.cc [af5c204a:ce8c12f]
- File:
-
- 1 edited
-
src/SymTab/Indexer.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
raf5c204a rce8c12f 124 124 }; 125 125 // properties for this type 126 bool existsUserDefinedFunc = false; // any user-defined function found 127 bool existsUserDefinedCtor = false; // any user-defined constructor found 128 bool existsUserDefinedDtor = false; // any user-defined destructor found 129 bool existsUserDefinedCopyFunc = false; // user-defined copy ctor found 130 bool existsUserDefinedDefaultCtor = false; // user-defined default ctor found 126 bool userDefinedFunc = false; // any user-defined function found 127 bool userDefinedCtor = false; // any user-defined constructor found 128 bool userDefinedDtor = false; // any user-defined destructor found 129 bool userDefinedCopyFunc = false; // user-defined copy ctor found 131 130 std::list< DeclBall > decls; 132 131 … … 139 138 bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() ); 140 139 decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefaultCtor, isDtor, isCopyFunc } ); 141 existsUserDefinedFunc = existsUserDefinedFunc || isUserDefinedFunc; 142 existsUserDefinedCtor = existsUserDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) ); 143 existsUserDefinedDtor = existsUserDefinedDtor || (isUserDefinedFunc && isDtor); 144 existsUserDefinedCopyFunc = existsUserDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc); 145 existsUserDefinedDefaultCtor = existsUserDefinedDefaultCtor || (isUserDefinedFunc && isDefaultCtor); 140 userDefinedFunc = userDefinedFunc || isUserDefinedFunc; 141 userDefinedCtor = userDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) ); 142 userDefinedDtor = userDefinedDtor || (isUserDefinedFunc && isDtor); 143 userDefinedCopyFunc = userDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc); 146 144 return *this; 147 145 } … … 158 156 assert( ! params.empty() ); 159 157 // use base type of pointer, so that qualifiers on the pointer type aren't considered. 160 Type * base = safe_dynamic_cast< PointerType * >( params.front()->get_type() )->get_base(); 158 Type * base = InitTweak::getPointerBase( params.front()->get_type() ); 159 assert( base ); 161 160 funcMap[ Mangler::mangle( base ) ] += function; 162 161 } else { … … 165 164 } 166 165 167 // if a type contains user defined ctor/dtor /assign, then special rules trigger, which determine168 // the set of ctor/dtor /assignthat are seen by the requester. In particular, if the user defines166 // if a type contains user defined ctor/dtors, then special rules trigger, which determine 167 // the set of ctor/dtors that are seen by the requester. In particular, if the user defines 169 168 // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor 170 169 // and dtor. If the user defines any ctor/dtor, then no generated field ctors should be seen. 171 // If the user defines any ctor then the generated default ctor should not be seen (intrinsic default 172 // ctor must be overridden exactly). 170 // If the user defines any ctor then the generated default ctor should not be seen. 173 171 for ( std::pair< const std::string, ValueType > & pair : funcMap ) { 174 172 ValueType & val = pair.second; 175 173 for ( ValueType::DeclBall ball : val.decls ) { 176 bool noUserDefinedFunc = ! val.existsUserDefinedFunc; 177 bool isUserDefinedFunc = ball.isUserDefinedFunc; 178 bool isAcceptableDefaultCtor = (! val.existsUserDefinedCtor || (! val.existsUserDefinedDefaultCtor && ball.decl->get_linkage() == LinkageSpec::Intrinsic)) && ball.isDefaultCtor; // allow default constructors only when no user-defined constructors exist, except in the case of intrinsics, which require exact overrides 179 bool isAcceptableCopyFunc = ! val.existsUserDefinedCopyFunc && ball.isCopyFunc; // handles copy ctor and assignment operator 180 bool isAcceptableDtor = ! val.existsUserDefinedDtor && ball.isDtor; 181 if ( noUserDefinedFunc || isUserDefinedFunc || isAcceptableDefaultCtor || isAcceptableCopyFunc || isAcceptableDtor ) { 174 if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefinedCtor && ball.isDefaultCtor) || (! val.userDefinedCopyFunc && ball.isCopyFunc) || (! val.userDefinedDtor && ball.isDtor) ) { 182 175 // decl conforms to the rules described above, so it should be seen by the requester 183 176 out.push_back( ball.decl ); … … 285 278 addType( typeDecl ); 286 279 acceptAll( typeDecl->get_assertions(), *this ); 287 acceptNewScope( typeDecl->get_init(), *this );288 280 } 289 281 … … 495 487 } 496 488 489 void Indexer::visit( UntypedValofExpr *valofExpr ) { 490 acceptNewScope( valofExpr->get_result(), *this ); 491 maybeAccept( valofExpr->get_body(), *this ); 492 } 493 497 494 void Indexer::visit( RangeExpr *rangeExpr ) { 498 495 maybeAccept( rangeExpr->get_low(), *this ); … … 513 510 acceptNewScope( tupleExpr->get_result(), *this ); 514 511 maybeAccept( tupleExpr->get_tuple(), *this ); 512 } 513 514 void Indexer::visit( MemberTupleExpr *tupleExpr ) { 515 acceptNewScope( tupleExpr->get_result(), *this ); 516 maybeAccept( tupleExpr->get_member(), *this ); 517 maybeAccept( tupleExpr->get_aggregate(), *this ); 515 518 } 516 519
Note:
See TracChangeset
for help on using the changeset viewer.