Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc6b791

Browse files
committed
CPP: Speed it up.
1 parent 55465c3 commit fc6b791

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

cpp/ql/src/Best Practices/Likely Errors/EmptyBlock.ql

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ predicate emptyBlockContainsNonchild(Block b) {
9191
*/
9292
predicate lineComment(Block b) {
9393
emptyBlock(_, b) and
94-
exists(File f, int line |
95-
f = b.getFile() and
96-
line = b.getLocation().getStartLine() and
97-
line = b.getLocation().getEndLine() and
98-
exists(Comment c |
99-
c.getFile() = f and
100-
c.getLocation().getStartLine() = line
94+
exists(Location bLocation, File f, int line |
95+
bLocation = b.getLocation() and
96+
f = bLocation.getFile() and
97+
line = bLocation.getStartLine() and
98+
line = bLocation.getEndLine() and
99+
exists(Comment c, Location cLocation |
100+
cLocation = c.getLocation() and
101+
cLocation.getFile() = f and
102+
cLocation.getStartLine() = line
101103
)
102104
)
103105
}

0 commit comments

Comments
 (0)