Skip to content

Commit 531b1e6

Browse files
committed
Preprocessor5: performance improvement PRE32-C
1 parent 090f074 commit 531b1e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

c/cert/src/rules/PRE32-C/MacroOrFunctionArgsContainHashToken.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ import codingstandards.cpp.PreprocessorDirective
2020
pragma[noinline]
2121
predicate isFunctionInvocationLocation(FunctionCall call, File f, int startline, int endline) {
2222
call.getLocation().hasLocationInfo(f.getAbsolutePath(), startline, _, _, _) and
23+
isFunctionSuccessorLocation(call.getASuccessor(), f, endline)
24+
}
25+
26+
pragma[noinline]
27+
predicate isFunctionSuccessorLocation(ControlFlowNode node, File f, int endline) {
2328
//for all function calls the closest location heurisitc we have for end line is the next node in cfg
24-
call.getASuccessor().getLocation().hasLocationInfo(f.getAbsolutePath(), endline, _, _, _)
29+
node.getLocation().hasLocationInfo(f.getAbsolutePath(), endline, _, _, _)
2530
}
2631

2732
PreprocessorDirective isLocatedInAFunctionInvocation(FunctionCall c) {

0 commit comments

Comments
 (0)