@@ -486,45 +486,72 @@ signature predicate interestedInFunctionDeclarations(
486486) ;
487487
488488module FunctionDeclarationTypeEquivalence<
489- TypeEquivalenceSig Config, interestedInFunctionDeclarations / 2 interestedInFunctions >
489+ TypeEquivalenceSig Config, interestedInFunctionDeclarations / 2 interestedInFunDecls >
490490{
491491 private predicate interestedInReturnTypes ( Type a , Type b ) {
492492 exists ( FunctionDeclarationEntry aFun , FunctionDeclarationEntry bFun |
493- interestedInFunctions ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
493+ interestedInFunDecls ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
494494 a = aFun .getType ( ) and
495495 b = bFun .getType ( )
496496 )
497497 }
498498
499499 private predicate interestedInParameterTypes ( Type a , Type b ) {
500500 exists ( FunctionDeclarationEntry aFun , FunctionDeclarationEntry bFun , int i |
501- interestedInFunctions ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
501+ interestedInFunDecls ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
502502 a = aFun .getParameterDeclarationEntry ( i ) .getType ( ) and
503503 b = bFun .getParameterDeclarationEntry ( i ) .getType ( )
504504 )
505505 }
506506
507507 predicate equalReturnTypes ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 ) {
508- interestedInFunctions ( f1 , f2 ) and
508+ interestedInFunDecls ( f1 , f2 ) and
509509 TypeEquivalence< Config , interestedInReturnTypes / 2 > :: equalTypes ( f1 .getType ( ) , f2 .getType ( ) )
510510 }
511511
512512 predicate equalParameterTypes ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 ) {
513- interestedInFunctions ( f1 , f2 ) and
513+ interestedInFunDecls ( f1 , f2 ) and
514514 f1 .getDeclaration ( ) = f2 .getDeclaration ( ) and
515515 forall ( int i | exists ( [ f1 , f2 ] .getParameterDeclarationEntry ( i ) ) |
516516 equalParameterTypesAt ( f1 , f2 , pragma [ only_bind_into ] ( i ) )
517517 )
518518 }
519519
520520 predicate equalParameterTypesAt ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 , int i ) {
521- interestedInFunctions ( f1 , f2 ) and
521+ interestedInFunDecls ( f1 , f2 ) and
522522 f1 .getDeclaration ( ) = f2 .getDeclaration ( ) and
523523 TypeEquivalence< Config , interestedInParameterTypes / 2 > :: equalTypes ( f1 .getParameterDeclarationEntry ( pragma [ only_bind_into ] ( i ) )
524524 .getType ( ) , f2 .getParameterDeclarationEntry ( pragma [ only_bind_into ] ( i ) ) .getType ( ) )
525525 }
526526}
527527
528+ signature predicate interestedInFunctionsByFunction ( Function f1 , Function f2 ) ;
529+
530+ module FunctionEquivalence<
531+ TypeEquivalenceSig Config, interestedInFunctionsByFunction / 2 interestedInFuncs>
532+ {
533+ private predicate interestedInParameterTypes ( Type a , Type b ) {
534+ exists ( Function aFun , Function bFun , int i |
535+ interestedInFuncs ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
536+ a = aFun .getParameter ( i ) .getType ( ) and
537+ b = bFun .getParameter ( i ) .getType ( )
538+ )
539+ }
540+
541+ predicate equalParameterTypes ( Function f1 , Function f2 ) {
542+ interestedInFuncs ( f1 , f2 ) and
543+ forall ( int i | exists ( [ f1 , f2 ] .getParameter ( i ) ) |
544+ equalParameterTypesAt ( f1 , f2 , pragma [ only_bind_into ] ( i ) )
545+ )
546+ }
547+
548+ predicate equalParameterTypesAt ( Function f1 , Function f2 , int i ) {
549+ interestedInFuncs ( f1 , f2 ) and
550+ TypeEquivalence< Config , interestedInParameterTypes / 2 > :: equalTypes ( f1 .getParameter ( pragma [ only_bind_into ] ( i ) )
551+ .getType ( ) , f2 .getParameter ( pragma [ only_bind_into ] ( i ) ) .getType ( ) )
552+ }
553+ }
554+
528555private class LeafType extends Type {
529556 LeafType ( ) {
530557 not this instanceof DerivedType and
0 commit comments