mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
CPP: Fix issue.
This commit is contained in:
@@ -78,7 +78,20 @@ predicate emptyBlockContainsNonchild(Block b) {
|
||||
)
|
||||
}
|
||||
|
||||
predicate lineComment(Block b) {
|
||||
exists(File f, int line |
|
||||
f = b.getFile() and
|
||||
line = b.getLocation().getStartLine() and
|
||||
line = b.getLocation().getEndLine() and
|
||||
exists(Comment c |
|
||||
c.getFile() = f and
|
||||
c.getLocation().getStartLine() = line
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
from ControlStructure s, Block eb
|
||||
where emptyBlock(s, eb)
|
||||
and not emptyBlockContainsNonchild(eb)
|
||||
and not lineComment(eb)
|
||||
select eb, "Empty block without comment"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
| empty_block.cpp:7:10:7:11 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:10:10:11:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:18:10:19:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:53:10:53:11 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:56:10:56:11 | { ... } | Empty block without comment |
|
||||
|
||||
Reference in New Issue
Block a user