mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
C++: Address review comments
This commit is contained in:
@@ -22,6 +22,7 @@ predicate blockContainsPreprocessorBranches(BasicBlock bb) {
|
||||
exists(PreprocessorBranch ppb, Location bbLoc, Location ppbLoc |
|
||||
bbLoc = bb.(Stmt).getLocation() and ppbLoc = ppb.getLocation()
|
||||
|
|
||||
bbLoc.getFile() = ppb.getFile() and
|
||||
bbLoc.getStartLine() < ppbLoc.getStartLine() and
|
||||
ppbLoc.getEndLine() < bbLoc.getEndLine()
|
||||
)
|
||||
@@ -33,8 +34,10 @@ where
|
||||
fc.getArgument(0) = v.getAnAccess() and
|
||||
bb = fc.getBasicBlock() and
|
||||
(
|
||||
// No block statement: if (x) free(x);
|
||||
bb = fc.getEnclosingStmt()
|
||||
or
|
||||
// Block statement with a single nested statement: if (x) { free(x); }
|
||||
strictcount(bb.(BlockStmt).getAStmt()) = 1
|
||||
) and
|
||||
strictcount(BasicBlock bb2 | gc.ensuresEq(_, 0, bb2, _) | bb2) = 1 and
|
||||
|
||||
Reference in New Issue
Block a user