mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
C++: Fold predicate sameLocation
This commit is contained in:
@@ -17,10 +17,17 @@ import TooFewArguments
|
|||||||
import TooManyArguments
|
import TooManyArguments
|
||||||
import semmle.code.cpp.commons.Exclusions
|
import semmle.code.cpp.commons.Exclusions
|
||||||
|
|
||||||
predicate sameLocation(Location loc1, Location loc2) {
|
predicate locInfo(Locatable e, File file, int line, int col) {
|
||||||
loc1.getFile() = loc2.getFile() and
|
e.getFile() = file and
|
||||||
loc1.getStartLine() = loc2.getStartLine() and
|
e.getLocation().getStartLine() = line and
|
||||||
loc1.getStartColumn() = loc2.getStartColumn()
|
e.getLocation().getStartColumn() = col
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate sameLocation(FunctionDeclarationEntry fde, FunctionCall fc) {
|
||||||
|
exists(File file, int line, int col |
|
||||||
|
locInfo(fde, file, line, col) and
|
||||||
|
locInfo(fc, file, line, col)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate isCompiledAsC(File f) {
|
predicate isCompiledAsC(File f) {
|
||||||
@@ -34,7 +41,7 @@ where
|
|||||||
isCompiledAsC(fdeIm.getFile()) and
|
isCompiledAsC(fdeIm.getFile()) and
|
||||||
not isFromMacroDefinition(fc) and
|
not isFromMacroDefinition(fc) and
|
||||||
fdeIm.isImplicit() and
|
fdeIm.isImplicit() and
|
||||||
sameLocation(fdeIm.getLocation(), fc.getLocation()) and
|
sameLocation(fdeIm, fc) and
|
||||||
not mistypedFunctionArguments(fc, _, _) and
|
not mistypedFunctionArguments(fc, _, _) and
|
||||||
not tooFewArguments(fc, _) and
|
not tooFewArguments(fc, _) and
|
||||||
not tooManyArguments(fc, _)
|
not tooManyArguments(fc, _)
|
||||||
|
|||||||
Reference in New Issue
Block a user