CPP: Fix issue.

This commit is contained in:
Geoffrey White
2018-10-29 16:26:40 +00:00
parent 630233fc3e
commit 3ccbeb0c65
2 changed files with 13 additions and 2 deletions

View File

@@ -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"

View File

@@ -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 |