Skip to content

Commit 19435e0

Browse files
committed
C++: Fix join order in CommentedOutCode
After the recent inlining of `unresolveElement`, the join order in `CommentedOutCode` became a problem. The join orderer was tempted to join the two `hasLocationInfo` calls first because they had one column in common. With this commit, they have no columns in common. It follows from the other predicates in the same file that this column would be the same, so there is no need to assert it in this predicate and risk that the join orderer uses that information. On Wireshark, the `CommentBlock::hasLocationInfo` predicate goes from taking 2m2s to taking 180ms. The query produces the same 7,448 alerts.
1 parent 4767d85 commit 19435e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/ql/src/Documentation/CommentedOutCode.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class CommentBlock extends Comment {
119119
*/
120120
predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
121121
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, _, _) and
122-
this.lastComment().getLocation().hasLocationInfo(filepath, _, _, endline, endcolumn)
122+
this.lastComment().getLocation().hasLocationInfo(_, _, _, endline, endcolumn)
123123
}
124124
}
125125

0 commit comments

Comments
 (0)