mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #20049 from github/nickrolfe/java-deleted-files
Java: use `overlayChangedFiles` in discard prediactes
This commit is contained in:
@@ -233,5 +233,5 @@ private predicate discardableLocation(string file, @location l) {
|
||||
/** Discard base locations in files fully extracted in the overlay. */
|
||||
overlay[discard_entity]
|
||||
private predicate discardLocation(@location l) {
|
||||
exists(string file | discardableLocation(file, l) and extractedInOverlay(file))
|
||||
exists(string file | discardableLocation(file, l) and overlayChangedFiles(file))
|
||||
}
|
||||
|
||||
@@ -30,15 +30,6 @@ string getRawFileForLoc(@location l) {
|
||||
exists(@file f | locations_default(l, f, _, _, _, _) and files(f, result))
|
||||
}
|
||||
|
||||
/** Holds for files fully extracted in the overlay. */
|
||||
overlay[local]
|
||||
predicate extractedInOverlay(string file) {
|
||||
isOverlay() and
|
||||
// numlines is used to restrict attention to fully extracted files and
|
||||
// ignore skeleton extracted files in the overlay
|
||||
exists(@locatable l | numlines(l, _, _, _) and file = getRawFile(l))
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@locatable` that should be discarded in the base variant if its file is
|
||||
* extracted in the overlay variant.
|
||||
@@ -54,7 +45,7 @@ abstract class DiscardableLocatable extends @locatable {
|
||||
|
||||
overlay[discard_entity]
|
||||
private predicate discardLocatable(@locatable el) {
|
||||
extractedInOverlay(el.(DiscardableLocatable).getRawFileInBase())
|
||||
overlayChangedFiles(el.(DiscardableLocatable).getRawFileInBase())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +68,7 @@ abstract class DiscardableReferableLocatable extends @locatable {
|
||||
overlay[discard_entity]
|
||||
private predicate discardReferableLocatable(@locatable el) {
|
||||
exists(DiscardableReferableLocatable drl | drl = el |
|
||||
extractedInOverlay(drl.getRawFileInBase()) and
|
||||
overlayChangedFiles(drl.getRawFileInBase()) and
|
||||
not drl.existsInOverlay()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user