Files
codeql/cpp/ql/test/library-tests/stmt/generated_blocks/stmt.ql
Jonas Jensen 4ef5c9af62 C++: Autoformat everything
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
2019-09-09 11:25:53 +02:00

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)