Skip to content

Commit 132bb9f

Browse files
committed
C++: Address (my own) review comments.
1 parent 8a92a42 commit 132bb9f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

cpp/ql/src/Critical/GlobalUseBeforeInit.ql

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,11 @@ predicate callReaches(Call call, ControlFlowNode successor) {
9898
)
9999
}
100100

101-
// To avoid many false alarms like `static int a = 1;`
102-
predicate initialisedAtDeclaration(GlobalVariable v) {
103-
exists(VariableDeclarationEntry vde |
104-
vde = v.getDefinition() and
105-
vde.isDefinition()
106-
)
107-
}
101+
/** Holds if `v` has an initializer. */
102+
predicate initialisedAtDeclaration(GlobalVariable v) { exists(v.getInitializer()) }
108103

109-
// No need to initialize those variables
110-
predicate isStdlibVariable(GlobalVariable v) { v.getName() = ["stdin", "stdout", "stderr"] }
104+
/** Holds if `v` is a global variable that does not need to be initialized. */
105+
predicate isStdlibVariable(GlobalVariable v) { v.hasGlobalName(["stdin", "stdout", "stderr"]) }
111106

112107
from GlobalVariable v, Function f
113108
where

0 commit comments

Comments
 (0)