C#: Remove the API special case for GetHashCode, Equals and IEquatable.Equals as these are now excluded based on their type.

This commit is contained in:
Michael Nebel
2022-04-06 10:45:28 +02:00
parent f6fd401df1
commit 8726766465

View File

@@ -17,25 +17,6 @@ module TaintTracking = CS::TaintTracking;
class Type = CS::Type;
/**
* Holds if `api` is an override or an interface implementation that
* is irrelevant to the data flow analysis.
*/
private predicate isIrrelevantOverrideOrImplementation(CS::Callable api) {
exists(CS::Callable exclude, CS::Method m |
(
api = m.getAnOverrider*().getUnboundDeclaration()
or
api = m.getAnUltimateImplementor().getUnboundDeclaration()
) and
exclude = m.getUnboundDeclaration()
|
exists(System::SystemObjectClass c | exclude = [c.getGetHashCodeMethod(), c.getEqualsMethod()])
or
exists(System::SystemIEquatableTInterface i | exclude = i.getEqualsMethod())
)
}
/**
* Holds if it is relevant to generate models for `api`.
*/
@@ -43,8 +24,7 @@ private predicate isRelevantForModels(CS::Callable api) {
[api.(CS::Modifiable), api.(CS::Accessor).getDeclaration()].isEffectivelyPublic() and
api.getDeclaringType().getNamespace().getQualifiedName() != "" and
not api instanceof CS::ConversionOperator and
not api instanceof Util::MainMethod and
not isIrrelevantOverrideOrImplementation(api)
not api instanceof Util::MainMethod
}
/**