@@ -17,10 +17,17 @@ import TooFewArguments
1717import TooManyArguments
1818import semmle.code.cpp.commons.Exclusions
1919
20- predicate sameLocation ( Location loc1 , Location loc2 ) {
21- loc1 .getFile ( ) = loc2 .getFile ( ) and
22- loc1 .getStartLine ( ) = loc2 .getStartLine ( ) and
23- loc1 .getStartColumn ( ) = loc2 .getStartColumn ( )
20+ predicate locInfo ( Locatable e , File file , int line , int col ) {
21+ e .getFile ( ) = file and
22+ e .getLocation ( ) .getStartLine ( ) = line and
23+ e .getLocation ( ) .getStartColumn ( ) = col
24+ }
25+
26+ predicate sameLocation ( FunctionDeclarationEntry fde , FunctionCall fc ) {
27+ exists ( File file , int line , int col |
28+ locInfo ( fde , file , line , col ) and
29+ locInfo ( fc , file , line , col )
30+ )
2431}
2532
2633predicate isCompiledAsC ( File f ) {
3441 isCompiledAsC ( fdeIm .getFile ( ) ) and
3542 not isFromMacroDefinition ( fc ) and
3643 fdeIm .isImplicit ( ) and
37- sameLocation ( fdeIm . getLocation ( ) , fc . getLocation ( ) ) and
44+ sameLocation ( fdeIm , fc ) and
3845 not mistypedFunctionArguments ( fc , _, _) and
3946 not tooFewArguments ( fc , _) and
4047 not tooManyArguments ( fc , _)
0 commit comments