mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
C#/Java: Invert api filtering logic.
This commit is contained in:
@@ -7,7 +7,7 @@ private import CaptureModelsSpecific
|
||||
private import CaptureModelsPrinting
|
||||
|
||||
class DataFlowTargetApi extends TargetApiSpecific {
|
||||
DataFlowTargetApi() { isRelevantForDataFlowModels(this) }
|
||||
DataFlowTargetApi() { not isUninterestingForDataFlowModels(this) }
|
||||
}
|
||||
|
||||
private module Printing implements PrintingSig {
|
||||
|
||||
@@ -63,13 +63,20 @@ private predicate hasManualModel(Callable api) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if it is relevant to generate models for `api` based on data flow analysis.
|
||||
* Holds if it is irrelevant to generate models for `api` based on data flow analysis.
|
||||
*
|
||||
* This serves as an extra filter for the `relevant` predicate.
|
||||
*/
|
||||
predicate isRelevantForDataFlowModels(Callable api) {
|
||||
(not api.getDeclaringType() instanceof J::Interface or exists(api.getBody()))
|
||||
predicate isUninterestingForDataFlowModels(Callable api) {
|
||||
api.getDeclaringType() instanceof J::Interface and not exists(api.getBody())
|
||||
}
|
||||
|
||||
predicate isRelevantForTypeBasedFlowModels(Callable api) { any() }
|
||||
/**
|
||||
* Holds if it is irrelevant to generate models for `api` based on type-based analysis.
|
||||
*
|
||||
* This serves as an extra filter for the `relevant` predicate.
|
||||
*/
|
||||
predicate isUninterestingForTypeBasedFlowModels(Callable api) { none() }
|
||||
|
||||
/**
|
||||
* A class of Callables that are relevant for generating summary, source and sinks models for.
|
||||
|
||||
@@ -296,7 +296,7 @@ private module ModelPrinting = PrintingImpl<Printing>;
|
||||
* on the Theorems for Free approach.
|
||||
*/
|
||||
class TypeBasedFlowTargetApi extends Specific::TargetApiSpecific {
|
||||
TypeBasedFlowTargetApi() { Specific::isRelevantForTypeBasedFlowModels(this) }
|
||||
TypeBasedFlowTargetApi() { not Specific::isUninterestingForTypeBasedFlowModels(this) }
|
||||
|
||||
/**
|
||||
* Gets the string representation of all type based summaries for `this`
|
||||
|
||||
Reference in New Issue
Block a user