mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
Some files that will change in #1736 have been spared. ./build -j4 target/jars/qlformat find ql/cpp/ql -name "*.ql" -print0 | xargs -0 target/jars/qlformat --input find ql/cpp/ql -name "*.qll" -print0 | xargs -0 target/jars/qlformat --input (cd ql && git checkout 'cpp/ql/src/semmle/code/cpp/ir/implementation/**/*SSA*.qll') buildutils-internal/scripts/pr-checks/sync-identical-files.py --latest
41 lines
924 B
Plaintext
41 lines
924 B
Plaintext
import cpp
|
|
|
|
newtype TMaybeStmtParent =
|
|
TStmtParent(StmtParent p) or
|
|
TNoStmtParent()
|
|
|
|
class MaybeStmtParent extends TMaybeStmtParent {
|
|
abstract string toString();
|
|
|
|
abstract Location getLocation();
|
|
}
|
|
|
|
class YesMaybeStmtParent extends MaybeStmtParent {
|
|
StmtParent p;
|
|
|
|
YesMaybeStmtParent() { this = TStmtParent(p) }
|
|
|
|
override string toString() { result = p.toString() }
|
|
|
|
override Location getLocation() { result = p.getLocation() }
|
|
|
|
StmtParent getStmtParent() { result = p }
|
|
}
|
|
|
|
class NoMaybeStmtParent extends MaybeStmtParent {
|
|
NoMaybeStmtParent() { this = TNoStmtParent() }
|
|
|
|
override string toString() { result = "<none>" }
|
|
|
|
override Location getLocation() { result instanceof UnknownLocation }
|
|
}
|
|
|
|
MaybeStmtParent parent(Stmt s) {
|
|
if exists(s.getParent())
|
|
then result.(YesMaybeStmtParent).getStmtParent() = s.getParent()
|
|
else result instanceof NoMaybeStmtParent
|
|
}
|
|
|
|
from Stmt s
|
|
select s, parent(s)
|