Files
codeql/docs/language/ql-training/query-examples/cpp/empty-if-cpp-model.ql
2019-09-05 08:40:36 +01:00

11 lines
231 B
Plaintext

import cpp
class EmptyBlock extends Block {
EmptyBlock() { this.isEmpty() }
}
from IfStmt ifstmt
where
ifstmt.getThen() instanceof EmptyBlock and
not exists(ifstmt.getElse())
select ifstmt, "This if-statement is redundant."