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"