From 84c674b992dfaab6d6cf857087385a4d145ceabf Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Wed, 15 Jan 2025 19:31:17 +0100 Subject: [PATCH 1/8] C++: Fix typos in IR translation comments --- .../cpp/ir/implementation/raw/internal/TranslatedCondition.qll | 2 +- .../cpp/ir/implementation/raw/internal/TranslatedElement.qll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCondition.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCondition.qll index 1616c9c434b1..4077283f0f3d 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCondition.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCondition.qll @@ -47,7 +47,7 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio { TranslatedFlexibleCondition() { this = TTranslatedFlexibleCondition(expr) } - final override predicate handlesDestructorsExplicitly() { none() } // TODO: this needs to be revisted when we get unnamed destructors + final override predicate handlesDestructorsExplicitly() { none() } // TODO: this needs to be revisited when we get unnamed destructors final override TranslatedElement getChild(int id) { id = 0 and result = this.getOperand() } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index 8e7e46c94c62..e22aa33f3605 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -166,7 +166,7 @@ private predicate ignoreExpr(Expr expr) { } /** - * Holds if the side effects of `expr` should be ignoredf for the purposes of IR generation. + * Holds if the side effects of `expr` should be ignored for the purposes of IR generation. * * In cases involving `constexpr`, a call can wind up as a constant expression. `ignoreExpr()` will * not hold for such a call, since we do need to translate the call (as a constant), but we need to From bc2f203c4b1a990b8740d421b74c4a550ab5eac0 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Wed, 15 Jan 2025 19:59:52 +0100 Subject: [PATCH 2/8] C++: Support `if consteval` and `if ! consteval` --- cpp/ql/lib/semmle/code/cpp/PrintAST.qll | 4 + .../code/cpp/controlflow/internal/CFG.qll | 19 ++ .../raw/internal/TranslatedStmt.qll | 55 ++++++ cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll | 162 ++++++++++++++++++ cpp/ql/lib/semmlecode.cpp.dbscheme | 14 ++ .../library-tests/consteval_if/cfg.expected | 124 ++++++++++++++ cpp/ql/test/library-tests/consteval_if/cfg.ql | 42 +++++ .../library-tests/consteval_if/stmts.expected | 25 +++ .../test/library-tests/consteval_if/stmts.ql | 4 + .../test/library-tests/consteval_if/test.cpp | 40 +++++ .../library-tests/ir/ir/PrintAST.expected | 119 +++++++++++++ .../library-tests/ir/ir/aliased_ir.expected | 98 +++++++++++ cpp/ql/test/library-tests/ir/ir/ir23.cpp | 59 +++++++ .../test/library-tests/ir/ir/raw_ir.expected | 137 +++++++++++++++ 14 files changed, 902 insertions(+) create mode 100644 cpp/ql/test/library-tests/consteval_if/cfg.expected create mode 100644 cpp/ql/test/library-tests/consteval_if/cfg.ql create mode 100644 cpp/ql/test/library-tests/consteval_if/stmts.expected create mode 100644 cpp/ql/test/library-tests/consteval_if/stmts.ql create mode 100644 cpp/ql/test/library-tests/consteval_if/test.cpp create mode 100644 cpp/ql/test/library-tests/ir/ir/ir23.cpp diff --git a/cpp/ql/lib/semmle/code/cpp/PrintAST.qll b/cpp/ql/lib/semmle/code/cpp/PrintAST.qll index 12061db454d4..11244c756206 100644 --- a/cpp/ql/lib/semmle/code/cpp/PrintAST.qll +++ b/cpp/ql/lib/semmle/code/cpp/PrintAST.qll @@ -912,6 +912,10 @@ private predicate namedStmtChildPredicates(Locatable s, Element e, string pred) or s.(ConstexprIfStmt).getElse() = e and pred = "getElse()" or + s.(ConstevalOrNotConstevalIfStmt).getThen() = e and pred = "getThen()" + or + s.(ConstevalOrNotConstevalIfStmt).getElse() = e and pred = "getElse()" + or s.(Handler).getParameter() = e and pred = "getParameter()" or s.(IfStmt).getInitialization() = e and pred = "getInitialization()" diff --git a/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll b/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll index c003ec4595ef..19b0d48fdfdb 100644 --- a/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll +++ b/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll @@ -876,6 +876,25 @@ private predicate subEdge(Pos p1, Node n1, Node n2, Pos p2) { p2.nodeAfter(n2, s) ) or + // ConstevalOrNotConstevalIfStmt -> { then, else } -> + exists(ConstevalOrNotConstevalIfStmt s | + p1.nodeAt(n1, s) and + p2.nodeBefore(n2, s.getThen()) + or + p1.nodeAt(n1, s) and + p2.nodeBefore(n2, s.getElse()) + or + p1.nodeAt(n1, s) and + not exists(s.getElse()) and + p2.nodeAfter(n2, s) + or + p1.nodeAfter(n1, s.getThen()) and + p2.nodeAfter(n2, s) + or + p1.nodeAfter(n1, s.getElse()) and + p2.nodeAfter(n2, s) + ) + or // WhileStmt -> condition ; body -> condition ; after dtors -> after exists(WhileStmt s | p1.nodeAt(n1, s) and diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll index e0c7d625e81c..41c1644c6183 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll @@ -1098,6 +1098,61 @@ class TranslatedConstExprIfStmt extends TranslatedIfLikeStmt { override predicate hasElse() { exists(stmt.getElse()) } } +class TranslatedConstevalOrNotConstevalIfStmt extends TranslatedStmt { + override ConstevalOrNotConstevalIfStmt stmt; + + override Instruction getFirstInstruction(EdgeKind kind) { + if not this.hasEvaluatedBranch() + then + kind instanceof GotoEdge and + result = this.getInstruction(OnlyInstructionTag()) + else result = this.getEvaluatedBranch().getFirstInstruction(kind) + } + + override TranslatedElement getChildInternal(int id) { + id = 0 and + result = this.getThen() + or + id = 1 and + result = this.getElse() + } + + override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) { + not this.hasEvaluatedBranch() and + opcode instanceof Opcode::NoOp and + tag = OnlyInstructionTag() and + resultType = getVoidType() + } + + override Instruction getALastInstructionInternal() { + if not this.hasEvaluatedBranch() + then result = this.getInstruction(OnlyInstructionTag()) + else result = this.getEvaluatedBranch().getALastInstruction() + } + + override TranslatedElement getLastChild() { result = this.getEvaluatedBranch() } + + override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) { + tag = OnlyInstructionTag() and + result = this.getParent().getChildSuccessor(this, kind) + } + + override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { + (child = this.getThen() or child = this.getElse()) and + result = this.getParent().getChildSuccessor(this, kind) + } + + TranslatedStmt getEvaluatedBranch() { + result = getTranslatedStmt(stmt.getRuntimeEvaluatedBranch()) + } + + predicate hasEvaluatedBranch() { stmt.hasRuntimeEvaluatedBranch() } + + TranslatedStmt getThen() { result = getTranslatedStmt(stmt.getThen()) } + + TranslatedStmt getElse() { result = getTranslatedStmt(stmt.getElse()) } +} + abstract class TranslatedLoop extends TranslatedStmt, ConditionContext { override Loop stmt; diff --git a/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll b/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll index b161da47620b..8958811453c1 100644 --- a/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll @@ -437,6 +437,168 @@ class ConstexprIfStmt extends ConditionalStmt, @stmt_constexpr_if { } } +/** + * A C/C++ '(not) consteval if'. For example, the `if consteval` statement + * in the following code: + * ```cpp + * if consteval { + * ... + * } + * ``` + */ +class ConstevalOrNotConstevalIfStmt extends Stmt, @stmt_consteval_or_not_consteval_if { + /** + * Gets the 'then' statement of this '(not) consteval if' statement. + * + * For example, for + * ```cpp + * if consteval { return true; } + * ``` + * the result is the `BlockStmt` `{ return true; }`. + */ + Stmt getThen() { consteval_if_then(underlyingElement(this), unresolveElement(result)) } + + /** + * Gets the 'else' statement of this '(not) constexpr if' statement, if any. + * + * For example, for + * ```cpp + * if consteval { return true; } else { return false; } + * ``` + * the result is the `BlockStmt` `{ return false; }`, and for + * ```cpp + * if consteval { return true; } + * ``` + * there is no result. + */ + Stmt getElse() { consteval_if_else(underlyingElement(this), unresolveElement(result)) } + + /** + * Holds if this '(not) constexpr if' statement has an 'else' statement. + * + * For example, this holds for + * ```cpp + * if consteval { return true; } else { return false; } + * ``` + * but not for + * ```cpp + * if consteval { return true; } + * ``` + */ + predicate hasElse() { exists(this.getElse()) } + + override predicate mayBeImpure() { + this.getThen().mayBeImpure() or + this.getElse().mayBeImpure() + } + + override predicate mayBeGloballyImpure() { + this.getThen().mayBeGloballyImpure() or + this.getElse().mayBeGloballyImpure() + } + + override MacroInvocation getGeneratingMacro() { + this.getThen().getGeneratingMacro() = result and + (this.hasElse() implies this.getElse().getGeneratingMacro() = result) + } + + /** + * Gets the statement of this '(not) consteval if' statement evaluated during compile time, if any. + * + * For example, for + * ```cpp + * if ! consteval { return true; } else { return false; } + * ``` + * the result is the `BlockStmt` `{ return false; }`, and for + * ```cpp + * if ! consteval { return true; } + * ``` + * there is no result. + */ + Stmt getCompileTimeEvaluatedBranch() { none() } + + /** + * Holds if this '(not) constexpr if' statement has a compile time evaluated statement. + * + * For example, this holds for + * ```cpp + * if ! consteval { return true; } else { return false; } + * ``` + * but not for + * ```cpp + * if ! consteval { return true; } + * ``` + */ + predicate hasCompileTimeEvaluatedBranch() { exists(this.getCompileTimeEvaluatedBranch()) } + + /** + * Gets the statement of this '(not) consteval if' statement evaluated during runtime, if any. + * + * For example, for + * ```cpp + * if consteval { return true; } else { return false; } + * ``` + * the result is the `BlockStmt` `{ return false; }`, and for + * ```cpp + * if consteval { return true; } + * ``` + * there is no result. + */ + Stmt getRuntimeEvaluatedBranch() { none() } + + /** + * Holds if this '(not) constexpr if' statement has a runtime evaluated statement. + * + * For example, this holds for + * ```cpp + * if consteval { return true; } else { return false; } + * ``` + * but not for + * ```cpp + * if consteval { return true; } + * ``` + */ + predicate hasRuntimeEvaluatedBranch() { exists(this.getRuntimeEvaluatedBranch()) } +} + +/** + * A C/C++ 'consteval if'. For example, the `if consteval` statement + * in the following code: + * ```cpp + * if consteval { + * ... + * } + * ``` + */ +class ConstevalIfStmt extends ConstevalOrNotConstevalIfStmt, @stmt_consteval_if { + override string getAPrimaryQlClass() { result = "ConstevalIfStmt" } + + override string toString() { result = "if consteval ..." } + + override Stmt getCompileTimeEvaluatedBranch() { result = this.getThen() } + + override Stmt getRuntimeEvaluatedBranch() { result = this.getElse() } +} + +/** + * A C/C++ 'not consteval if'. For example, the `if ! consteval` statement + * in the following code: + * ```cpp + * if ! consteval { + * ... + * } + * ``` + */ +class NotConstevalIfStmt extends ConstevalOrNotConstevalIfStmt, @stmt_not_consteval_if { + override string getAPrimaryQlClass() { result = "NotConstevalIfStmt" } + + override string toString() { result = "if ! consteval ..." } + + override Stmt getCompileTimeEvaluatedBranch() { result = this.getElse() } + + override Stmt getRuntimeEvaluatedBranch() { result = this.getThen() } +} + private class TLoop = @stmt_while or @stmt_end_test_while or @stmt_range_based_for or @stmt_for; /** diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index a01d8f91b8d4..1aa71a4a687f 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -2152,6 +2152,8 @@ case @stmt.kind of // ... 34 @stmt_finally_end deprecated | 35 = @stmt_constexpr_if | 37 = @stmt_co_return +| 38 = @stmt_consteval_if +| 39 = @stmt_not_consteval_if ; type_vla( @@ -2194,6 +2196,18 @@ constexpr_if_else( int else_id: @stmt ref ); +@stmt_consteval_or_not_consteval_if = @stmt_consteval_if | @stmt_not_consteval_if; + +consteval_if_then( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int then_id: @stmt ref +); + +consteval_if_else( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int else_id: @stmt ref +); + while_body( unique int while_stmt: @stmt_while ref, int body_id: @stmt ref diff --git a/cpp/ql/test/library-tests/consteval_if/cfg.expected b/cpp/ql/test/library-tests/consteval_if/cfg.expected new file mode 100644 index 000000000000..f17d207aa598 --- /dev/null +++ b/cpp/ql/test/library-tests/consteval_if/cfg.expected @@ -0,0 +1,124 @@ +| ClassWithDestructor::ClassWithDestructor | false | 157 | 157 | ClassWithDestructor | +| ClassWithDestructor::ClassWithDestructor | false | 296 | 296 | ClassWithDestructor | +| ClassWithDestructor::ClassWithDestructor | false | 302 | 302 | ClassWithDestructor | +| ClassWithDestructor::operator bool | false | 173 | 173 | operator bool | +| ClassWithDestructor::operator= | false | 288 | 288 | operator= | +| ClassWithDestructor::~ClassWithDestructor | false | 190 | 190 | ~ClassWithDestructor | +| __va_list_tag::operator= | false | 66 | 66 | operator= | +| __va_list_tag::operator= | false | 72 | 72 | operator= | +| destruction_on_consteval | false | 193 | 193 | destruction_on_consteval | +| destruction_on_consteval | false | 198 | 198 | if consteval ... | +| destruction_on_consteval | false | 200 | 200 | return ... | +| destruction_on_consteval | false | 204 | 204 | 1 | +| destruction_on_consteval | false | 205 | 205 | { ... } | +| destruction_on_consteval | false | 208 | 208 | call to ClassWithDestructor | +| destruction_on_consteval | false | 210 | 210 | initializer for cwd | +| destruction_on_consteval | false | 213 | 213 | declaration | +| destruction_on_consteval | false | 215 | 215 | return ... | +| destruction_on_consteval | false | 218 | 218 | call to operator bool | +| destruction_on_consteval | false | 219 | 219 | cwd | +| destruction_on_consteval | false | 221 | 221 | (const ClassWithDestructor)... | +| destruction_on_consteval | false | 222 | 222 | { ... } | +| destruction_on_consteval | false | 224 | 224 | { ... } | +| destruction_on_consteval | false | 226 | 226 | cwd | +| destruction_on_consteval | false | 228 | 228 | call to cwd.~ClassWithDestructor | +| destruction_on_consteval | false | 229 | 229 | cwd | +| destruction_on_consteval | false | 230 | 230 | call to cwd.~ClassWithDestructor | +| destruction_on_consteval | true | 198 | 205 | | +| destruction_on_consteval | true | 198 | 222 | | +| destruction_on_consteval | true | 200 | 204 | | +| destruction_on_consteval | true | 204 | 193 | | +| destruction_on_consteval | true | 205 | 200 | | +| destruction_on_consteval | true | 208 | 215 | | +| destruction_on_consteval | true | 210 | 208 | | +| destruction_on_consteval | true | 213 | 210 | | +| destruction_on_consteval | true | 215 | 219 | | +| destruction_on_consteval | true | 218 | 226 | | +| destruction_on_consteval | true | 219 | 218 | | +| destruction_on_consteval | true | 222 | 213 | | +| destruction_on_consteval | true | 224 | 198 | | +| destruction_on_consteval | true | 226 | 228 | | +| destruction_on_consteval | true | 228 | 193 | | +| destruction_on_consteval | true | 229 | 230 | | +| destruction_on_consteval | true | 230 | 193 | | +| destruction_on_consteval2 | false | 147 | 147 | destruction_on_consteval2 | +| destruction_on_consteval2 | false | 152 | 152 | declaration | +| destruction_on_consteval2 | false | 155 | 155 | call to ClassWithDestructor | +| destruction_on_consteval2 | false | 158 | 158 | initializer for cwd | +| destruction_on_consteval2 | false | 161 | 161 | if consteval ... | +| destruction_on_consteval2 | false | 163 | 163 | return ... | +| destruction_on_consteval2 | false | 167 | 167 | 1 | +| destruction_on_consteval2 | false | 168 | 168 | { ... } | +| destruction_on_consteval2 | false | 170 | 170 | return ... | +| destruction_on_consteval2 | false | 178 | 178 | call to operator bool | +| destruction_on_consteval2 | false | 179 | 179 | cwd | +| destruction_on_consteval2 | false | 182 | 182 | (const ClassWithDestructor)... | +| destruction_on_consteval2 | false | 183 | 183 | { ... } | +| destruction_on_consteval2 | false | 185 | 185 | { ... } | +| destruction_on_consteval2 | false | 187 | 187 | cwd | +| destruction_on_consteval2 | false | 189 | 189 | call to cwd.~ClassWithDestructor | +| destruction_on_consteval2 | false | 191 | 191 | cwd | +| destruction_on_consteval2 | false | 192 | 192 | call to cwd.~ClassWithDestructor | +| destruction_on_consteval2 | true | 152 | 158 | | +| destruction_on_consteval2 | true | 155 | 161 | | +| destruction_on_consteval2 | true | 158 | 155 | | +| destruction_on_consteval2 | true | 161 | 168 | | +| destruction_on_consteval2 | true | 161 | 183 | | +| destruction_on_consteval2 | true | 163 | 167 | | +| destruction_on_consteval2 | true | 167 | 187 | | +| destruction_on_consteval2 | true | 168 | 163 | | +| destruction_on_consteval2 | true | 170 | 179 | | +| destruction_on_consteval2 | true | 178 | 191 | | +| destruction_on_consteval2 | true | 179 | 178 | | +| destruction_on_consteval2 | true | 183 | 170 | | +| destruction_on_consteval2 | true | 185 | 152 | | +| destruction_on_consteval2 | true | 187 | 189 | | +| destruction_on_consteval2 | true | 189 | 147 | | +| destruction_on_consteval2 | true | 191 | 192 | | +| destruction_on_consteval2 | true | 192 | 147 | | +| test | false | 231 | 231 | test | +| test | false | 236 | 236 | declaration | +| test | false | 241 | 241 | if consteval ... | +| test | false | 243 | 243 | ExprStmt | +| test | false | 245 | 245 | x | +| test | false | 249 | 249 | 1 | +| test | false | 250 | 250 | ... = ... | +| test | false | 252 | 252 | { ... } | +| test | false | 254 | 254 | ExprStmt | +| test | false | 256 | 256 | x | +| test | false | 260 | 260 | 2 | +| test | false | 261 | 261 | ... = ... | +| test | false | 263 | 263 | { ... } | +| test | false | 265 | 265 | if consteval ... | +| test | false | 267 | 267 | ExprStmt | +| test | false | 269 | 269 | x | +| test | false | 273 | 273 | 3 | +| test | false | 274 | 274 | ... = ... | +| test | false | 276 | 276 | { ... } | +| test | false | 278 | 278 | return ... | +| test | false | 280 | 280 | x | +| test | false | 282 | 282 | (bool)... | +| test | false | 283 | 283 | { ... } | +| test | true | 236 | 241 | | +| test | true | 241 | 252 | | +| test | true | 241 | 263 | | +| test | true | 243 | 249 | | +| test | true | 245 | 250 | | +| test | true | 249 | 245 | | +| test | true | 250 | 265 | | +| test | true | 252 | 243 | | +| test | true | 254 | 260 | | +| test | true | 256 | 261 | | +| test | true | 260 | 256 | | +| test | true | 261 | 265 | | +| test | true | 263 | 254 | | +| test | true | 265 | 276 | | +| test | true | 265 | 278 | | +| test | true | 267 | 273 | | +| test | true | 269 | 274 | | +| test | true | 273 | 269 | | +| test | true | 274 | 278 | | +| test | true | 276 | 267 | | +| test | true | 278 | 280 | | +| test | true | 280 | 231 | | +| test | true | 283 | 236 | | diff --git a/cpp/ql/test/library-tests/consteval_if/cfg.ql b/cpp/ql/test/library-tests/consteval_if/cfg.ql new file mode 100644 index 000000000000..0e1f45caf193 --- /dev/null +++ b/cpp/ql/test/library-tests/consteval_if/cfg.ql @@ -0,0 +1,42 @@ +/** + * query-type: graph + * + * @kind graph-equivalence-test + */ + +import cpp + +class DestructorCallEnhanced extends DestructorCall { + override string toString() { + if exists(this.getQualifier().(VariableAccess).getTarget().getName()) + then + result = + "call to " + this.getQualifier().(VariableAccess).getTarget().getName() + "." + + this.getTarget().getName() + else result = super.toString() + } +} + +string scope(ControlFlowNode x) { + if exists(x.getControlFlowScope().getQualifiedName()) + then result = x.getControlFlowScope().getQualifiedName() + else result = "" +} + +predicate isNode(boolean isEdge, ControlFlowNode x, ControlFlowNode y, string label) { + isEdge = false and x = y and label = x.toString() +} + +predicate isSuccessor(boolean isEdge, ControlFlowNode x, ControlFlowNode y, string label) { + exists(string truelabel, string falselabel | + isEdge = true and + x.getASuccessor() = y and + (if x.getATrueSuccessor() = y then truelabel = "T" else truelabel = "") and + (if x.getAFalseSuccessor() = y then falselabel = "F" else falselabel = "") and + label = truelabel + falselabel + ) +} + +from boolean isEdge, ControlFlowNode x, ControlFlowNode y, string label +where isNode(isEdge, x, y, label) or isSuccessor(isEdge, x, y, label) +select scope(x), isEdge, x, y, label diff --git a/cpp/ql/test/library-tests/consteval_if/stmts.expected b/cpp/ql/test/library-tests/consteval_if/stmts.expected new file mode 100644 index 000000000000..40233f9e014d --- /dev/null +++ b/cpp/ql/test/library-tests/consteval_if/stmts.expected @@ -0,0 +1,25 @@ +| test.cpp:3:23:14:1 | { ... } | +| test.cpp:4:5:4:10 | declaration | +| test.cpp:5:5:9:5 | if consteval ... | +| test.cpp:5:18:7:5 | { ... } | +| test.cpp:6:9:6:14 | ExprStmt | +| test.cpp:7:12:9:5 | { ... } | +| test.cpp:8:9:8:14 | ExprStmt | +| test.cpp:10:5:12:5 | if consteval ... | +| test.cpp:10:18:12:5 | { ... } | +| test.cpp:11:9:11:14 | ExprStmt | +| test.cpp:13:5:13:13 | return ... | +| test.cpp:24:33:31:1 | { ... } | +| test.cpp:25:3:30:3 | if consteval ... | +| test.cpp:25:16:27:3 | { ... } | +| test.cpp:26:5:26:16 | return ... | +| test.cpp:27:10:30:3 | { ... } | +| test.cpp:28:5:28:28 | declaration | +| test.cpp:29:5:29:15 | return ... | +| test.cpp:33:34:40:1 | { ... } | +| test.cpp:34:3:34:26 | declaration | +| test.cpp:35:3:39:3 | if consteval ... | +| test.cpp:35:16:37:3 | { ... } | +| test.cpp:36:5:36:16 | return ... | +| test.cpp:37:10:39:3 | { ... } | +| test.cpp:38:5:38:15 | return ... | diff --git a/cpp/ql/test/library-tests/consteval_if/stmts.ql b/cpp/ql/test/library-tests/consteval_if/stmts.ql new file mode 100644 index 000000000000..0d77580b769f --- /dev/null +++ b/cpp/ql/test/library-tests/consteval_if/stmts.ql @@ -0,0 +1,4 @@ +import cpp + +from Stmt s +select s diff --git a/cpp/ql/test/library-tests/consteval_if/test.cpp b/cpp/ql/test/library-tests/consteval_if/test.cpp new file mode 100644 index 000000000000..7d6c2243aeb5 --- /dev/null +++ b/cpp/ql/test/library-tests/consteval_if/test.cpp @@ -0,0 +1,40 @@ +// semmle-extractor-options: -std=c++23 + +constexpr bool test() { + int x; + if consteval { + x = 1; + } else { + x = 2; + } + if consteval { + x = 3; + } + return x; +} + +struct ClassWithDestructor +{ + ClassWithDestructor(); + ClassWithDestructor(const char*); + ~ClassWithDestructor(); + operator bool() const; +}; + +bool destruction_on_consteval() { + if consteval { + return true; + } else { + ClassWithDestructor cwd; + return cwd; + } +} + +bool destruction_on_consteval2() { + ClassWithDestructor cwd; + if consteval { + return true; + } else { + return cwd; + } +} diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index bfb123fa6843..530bb5bb12f6 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -24118,6 +24118,125 @@ ir.cpp: # 2725| getExpr().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) # 2725| Type = [PlainCharType] char # 2725| ValueCategory = prvalue(load) +ir23.cpp: +# 1| [TopLevelFunction] bool consteval_1() +# 1| : +# 2| getEntryPoint(): [BlockStmt] { ... } +# 3| getStmt(0): [ConstevalIfStmt] if consteval ... +# 3| getThen(): [BlockStmt] { ... } +# 4| getStmt(0): [ReturnStmt] return ... +# 4| getExpr(): [Literal] 1 +# 4| Type = [BoolType] bool +# 4| Value = [Literal] 1 +# 4| ValueCategory = prvalue +# 5| getElse(): [BlockStmt] { ... } +# 6| getStmt(0): [ReturnStmt] return ... +# 6| getExpr(): [Literal] 0 +# 6| Type = [BoolType] bool +# 6| Value = [Literal] 0 +# 6| ValueCategory = prvalue +# 10| [TopLevelFunction] bool consteval_2() +# 10| : +# 11| getEntryPoint(): [BlockStmt] { ... } +# 12| getStmt(0): [NotConstevalIfStmt] if ! consteval ... +# 12| getThen(): [BlockStmt] { ... } +# 13| getStmt(0): [ReturnStmt] return ... +# 13| getExpr(): [Literal] 1 +# 13| Type = [BoolType] bool +# 13| Value = [Literal] 1 +# 13| ValueCategory = prvalue +# 14| getElse(): [BlockStmt] { ... } +# 15| getStmt(0): [ReturnStmt] return ... +# 15| getExpr(): [Literal] 0 +# 15| Type = [BoolType] bool +# 15| Value = [Literal] 0 +# 15| ValueCategory = prvalue +# 19| [TopLevelFunction] bool consteval_3() +# 19| : +# 20| getEntryPoint(): [BlockStmt] { ... } +# 21| getStmt(0): [ConstevalIfStmt] if consteval ... +# 21| getThen(): [BlockStmt] { ... } +# 22| getStmt(0): [ReturnStmt] return ... +# 22| getExpr(): [Literal] 1 +# 22| Type = [BoolType] bool +# 22| Value = [Literal] 1 +# 22| ValueCategory = prvalue +# 25| getStmt(1): [ReturnStmt] return ... +# 25| getExpr(): [Literal] 0 +# 25| Type = [BoolType] bool +# 25| Value = [Literal] 0 +# 25| ValueCategory = prvalue +# 28| [TopLevelFunction] bool consteval_4() +# 28| : +# 29| getEntryPoint(): [BlockStmt] { ... } +# 30| getStmt(0): [NotConstevalIfStmt] if ! consteval ... +# 30| getThen(): [BlockStmt] { ... } +# 31| getStmt(0): [ReturnStmt] return ... +# 31| getExpr(): [Literal] 1 +# 31| Type = [BoolType] bool +# 31| Value = [Literal] 1 +# 31| ValueCategory = prvalue +# 34| getStmt(1): [ReturnStmt] return ... +# 34| getExpr(): [Literal] 0 +# 34| Type = [BoolType] bool +# 34| Value = [Literal] 0 +# 34| ValueCategory = prvalue +# 37| [TopLevelFunction] bool consteval_5() +# 37| : +# 38| getEntryPoint(): [BlockStmt] { ... } +# 39| getStmt(0): [DeclStmt] declaration +# 39| getDeclarationEntry(0): [VariableDeclarationEntry] definition of r +# 39| Type = [BoolType] bool +# 39| getVariable().getInitializer(): [Initializer] initializer for r +# 39| getExpr(): [Literal] 1 +# 39| Type = [BoolType] bool +# 39| Value = [Literal] 1 +# 39| ValueCategory = prvalue +# 41| getStmt(1): [NotConstevalIfStmt] if ! consteval ... +# 41| getThen(): [BlockStmt] { ... } +# 42| getStmt(0): [ExprStmt] ExprStmt +# 42| getExpr(): [AssignExpr] ... = ... +# 42| Type = [BoolType] bool +# 42| ValueCategory = lvalue +# 42| getLValue(): [VariableAccess] r +# 42| Type = [BoolType] bool +# 42| ValueCategory = lvalue +# 42| getRValue(): [Literal] 0 +# 42| Type = [BoolType] bool +# 42| Value = [Literal] 0 +# 42| ValueCategory = prvalue +# 45| getStmt(2): [ReturnStmt] return ... +# 45| getExpr(): [VariableAccess] r +# 45| Type = [BoolType] bool +# 45| ValueCategory = prvalue(load) +# 48| [TopLevelFunction] bool consteval_6() +# 48| : +# 49| getEntryPoint(): [BlockStmt] { ... } +# 50| getStmt(0): [DeclStmt] declaration +# 50| getDeclarationEntry(0): [VariableDeclarationEntry] definition of r +# 50| Type = [BoolType] bool +# 50| getVariable().getInitializer(): [Initializer] initializer for r +# 50| getExpr(): [Literal] 1 +# 50| Type = [BoolType] bool +# 50| Value = [Literal] 1 +# 50| ValueCategory = prvalue +# 52| getStmt(1): [ConstevalIfStmt] if consteval ... +# 52| getThen(): [BlockStmt] { ... } +# 53| getStmt(0): [ExprStmt] ExprStmt +# 53| getExpr(): [AssignExpr] ... = ... +# 53| Type = [BoolType] bool +# 53| ValueCategory = lvalue +# 53| getLValue(): [VariableAccess] r +# 53| Type = [BoolType] bool +# 53| ValueCategory = lvalue +# 53| getRValue(): [Literal] 0 +# 53| Type = [BoolType] bool +# 53| Value = [Literal] 0 +# 53| ValueCategory = prvalue +# 56| getStmt(2): [ReturnStmt] return ... +# 56| getExpr(): [VariableAccess] r +# 56| Type = [BoolType] bool +# 56| ValueCategory = prvalue(load) many-defs-per-use.cpp: # 34| [TopLevelFunction] void many_defs_per_use() # 34| : diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected index 4f340042cb9a..9b491395a508 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected @@ -19740,6 +19740,104 @@ ir.cpp: # 2724| v2724_12(void) = AliasedUse : ~m2725_8 # 2724| v2724_13(void) = ExitFunction : +ir23.cpp: +# 1| bool consteval_1() +# 1| Block 0 +# 1| v1_1(void) = EnterFunction : +# 1| m1_2(unknown) = AliasedDefinition : +# 1| m1_3(unknown) = InitializeNonLocal : +# 1| m1_4(unknown) = Chi : total:m1_2, partial:m1_3 +# 6| r6_1(glval) = VariableAddress[#return] : +# 6| r6_2(bool) = Constant[0] : +# 6| m6_3(bool) = Store[#return] : &:r6_1, r6_2 +# 1| r1_5(glval) = VariableAddress[#return] : +# 1| v1_6(void) = ReturnValue : &:r1_5, m6_3 +# 1| v1_7(void) = AliasedUse : m1_3 +# 1| v1_8(void) = ExitFunction : + +# 10| bool consteval_2() +# 10| Block 0 +# 10| v10_1(void) = EnterFunction : +# 10| m10_2(unknown) = AliasedDefinition : +# 10| m10_3(unknown) = InitializeNonLocal : +# 10| m10_4(unknown) = Chi : total:m10_2, partial:m10_3 +# 13| r13_1(glval) = VariableAddress[#return] : +# 13| r13_2(bool) = Constant[1] : +# 13| m13_3(bool) = Store[#return] : &:r13_1, r13_2 +# 10| r10_5(glval) = VariableAddress[#return] : +# 10| v10_6(void) = ReturnValue : &:r10_5, m13_3 +# 10| v10_7(void) = AliasedUse : m10_3 +# 10| v10_8(void) = ExitFunction : + +# 19| bool consteval_3() +# 19| Block 0 +# 19| v19_1(void) = EnterFunction : +# 19| m19_2(unknown) = AliasedDefinition : +# 19| m19_3(unknown) = InitializeNonLocal : +# 19| m19_4(unknown) = Chi : total:m19_2, partial:m19_3 +# 21| v21_1(void) = NoOp : +# 25| r25_1(glval) = VariableAddress[#return] : +# 25| r25_2(bool) = Constant[0] : +# 25| m25_3(bool) = Store[#return] : &:r25_1, r25_2 +# 19| r19_5(glval) = VariableAddress[#return] : +# 19| v19_6(void) = ReturnValue : &:r19_5, m25_3 +# 19| v19_7(void) = AliasedUse : m19_3 +# 19| v19_8(void) = ExitFunction : + +# 28| bool consteval_4() +# 28| Block 0 +# 28| v28_1(void) = EnterFunction : +# 28| m28_2(unknown) = AliasedDefinition : +# 28| m28_3(unknown) = InitializeNonLocal : +# 28| m28_4(unknown) = Chi : total:m28_2, partial:m28_3 +# 31| r31_1(glval) = VariableAddress[#return] : +# 31| r31_2(bool) = Constant[1] : +# 31| m31_3(bool) = Store[#return] : &:r31_1, r31_2 +# 28| r28_5(glval) = VariableAddress[#return] : +# 28| v28_6(void) = ReturnValue : &:r28_5, m31_3 +# 28| v28_7(void) = AliasedUse : m28_3 +# 28| v28_8(void) = ExitFunction : + +# 37| bool consteval_5() +# 37| Block 0 +# 37| v37_1(void) = EnterFunction : +# 37| m37_2(unknown) = AliasedDefinition : +# 37| m37_3(unknown) = InitializeNonLocal : +# 37| m37_4(unknown) = Chi : total:m37_2, partial:m37_3 +# 39| r39_1(glval) = VariableAddress[r] : +# 39| r39_2(bool) = Constant[1] : +# 39| m39_3(bool) = Store[r] : &:r39_1, r39_2 +# 42| r42_1(bool) = Constant[0] : +# 42| r42_2(glval) = VariableAddress[r] : +# 42| m42_3(bool) = Store[r] : &:r42_2, r42_1 +# 45| r45_1(glval) = VariableAddress[#return] : +# 45| r45_2(glval) = VariableAddress[r] : +# 45| r45_3(bool) = Load[r] : &:r45_2, m42_3 +# 45| m45_4(bool) = Store[#return] : &:r45_1, r45_3 +# 37| r37_5(glval) = VariableAddress[#return] : +# 37| v37_6(void) = ReturnValue : &:r37_5, m45_4 +# 37| v37_7(void) = AliasedUse : m37_3 +# 37| v37_8(void) = ExitFunction : + +# 48| bool consteval_6() +# 48| Block 0 +# 48| v48_1(void) = EnterFunction : +# 48| m48_2(unknown) = AliasedDefinition : +# 48| m48_3(unknown) = InitializeNonLocal : +# 48| m48_4(unknown) = Chi : total:m48_2, partial:m48_3 +# 50| r50_1(glval) = VariableAddress[r] : +# 50| r50_2(bool) = Constant[1] : +# 50| m50_3(bool) = Store[r] : &:r50_1, r50_2 +# 52| v52_1(void) = NoOp : +# 56| r56_1(glval) = VariableAddress[#return] : +# 56| r56_2(glval) = VariableAddress[r] : +# 56| r56_3(bool) = Load[r] : &:r56_2, m50_3 +# 56| m56_4(bool) = Store[#return] : &:r56_1, r56_3 +# 48| r48_5(glval) = VariableAddress[#return] : +# 48| v48_6(void) = ReturnValue : &:r48_5, m56_4 +# 48| v48_7(void) = AliasedUse : m48_3 +# 48| v48_8(void) = ExitFunction : + many-defs-per-use.cpp: # 34| void many_defs_per_use() # 34| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/ir23.cpp b/cpp/ql/test/library-tests/ir/ir/ir23.cpp new file mode 100644 index 000000000000..607d28d0acc1 --- /dev/null +++ b/cpp/ql/test/library-tests/ir/ir/ir23.cpp @@ -0,0 +1,59 @@ +constexpr bool consteval_1() noexcept +{ + if consteval { + return true; + } else { + return false; + } +} + +constexpr bool consteval_2() noexcept +{ + if ! consteval { + return true; + } else { + return false; + } +} + +constexpr bool consteval_3() noexcept +{ + if consteval { + return true; + } + + return false; +} + +constexpr bool consteval_4() noexcept +{ + if ! consteval { + return true; + } + + return false; +} + +constexpr bool consteval_5() noexcept +{ + bool r = true; + + if ! consteval { + r = false; + } + + return r; +} + +constexpr bool consteval_6() noexcept +{ + bool r = true; + + if consteval { + r = false; + } + + return r; +} + +// semmle-extractor-options: -std=c++23 diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 31faa22d9fcd..a71422d93f30 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -18055,6 +18055,143 @@ ir.cpp: # 2724| v2724_10(void) = AliasedUse : ~m? # 2724| v2724_11(void) = ExitFunction : +ir23.cpp: +# 1| bool consteval_1() +# 1| Block 0 +# 1| v1_1(void) = EnterFunction : +# 1| mu1_2(unknown) = AliasedDefinition : +# 1| mu1_3(unknown) = InitializeNonLocal : +# 6| r6_1(glval) = VariableAddress[#return] : +# 6| r6_2(bool) = Constant[0] : +# 6| mu6_3(bool) = Store[#return] : &:r6_1, r6_2 +#-----| Goto -> Block 1 + +# 1| Block 1 +# 1| r1_4(glval) = VariableAddress[#return] : +# 1| v1_5(void) = ReturnValue : &:r1_4, ~m? +# 1| v1_6(void) = AliasedUse : ~m? +# 1| v1_7(void) = ExitFunction : + +# 4| Block 2 +# 4| r4_1(glval) = VariableAddress[#return] : +# 4| r4_2(bool) = Constant[1] : +# 4| mu4_3(bool) = Store[#return] : &:r4_1, r4_2 +#-----| Goto -> Block 1 + +# 10| bool consteval_2() +# 10| Block 0 +# 10| v10_1(void) = EnterFunction : +# 10| mu10_2(unknown) = AliasedDefinition : +# 10| mu10_3(unknown) = InitializeNonLocal : +# 13| r13_1(glval) = VariableAddress[#return] : +# 13| r13_2(bool) = Constant[1] : +# 13| mu13_3(bool) = Store[#return] : &:r13_1, r13_2 +#-----| Goto -> Block 1 + +# 10| Block 1 +# 10| r10_4(glval) = VariableAddress[#return] : +# 10| v10_5(void) = ReturnValue : &:r10_4, ~m? +# 10| v10_6(void) = AliasedUse : ~m? +# 10| v10_7(void) = ExitFunction : + +# 15| Block 2 +# 15| r15_1(glval) = VariableAddress[#return] : +# 15| r15_2(bool) = Constant[0] : +# 15| mu15_3(bool) = Store[#return] : &:r15_1, r15_2 +#-----| Goto -> Block 1 + +# 19| bool consteval_3() +# 19| Block 0 +# 19| v19_1(void) = EnterFunction : +# 19| mu19_2(unknown) = AliasedDefinition : +# 19| mu19_3(unknown) = InitializeNonLocal : +# 21| v21_1(void) = NoOp : +# 25| r25_1(glval) = VariableAddress[#return] : +# 25| r25_2(bool) = Constant[0] : +# 25| mu25_3(bool) = Store[#return] : &:r25_1, r25_2 +#-----| Goto -> Block 1 + +# 19| Block 1 +# 19| r19_4(glval) = VariableAddress[#return] : +# 19| v19_5(void) = ReturnValue : &:r19_4, ~m? +# 19| v19_6(void) = AliasedUse : ~m? +# 19| v19_7(void) = ExitFunction : + +# 22| Block 2 +# 22| r22_1(glval) = VariableAddress[#return] : +# 22| r22_2(bool) = Constant[1] : +# 22| mu22_3(bool) = Store[#return] : &:r22_1, r22_2 +#-----| Goto -> Block 1 + +# 28| bool consteval_4() +# 28| Block 0 +# 28| v28_1(void) = EnterFunction : +# 28| mu28_2(unknown) = AliasedDefinition : +# 28| mu28_3(unknown) = InitializeNonLocal : +# 31| r31_1(glval) = VariableAddress[#return] : +# 31| r31_2(bool) = Constant[1] : +# 31| mu31_3(bool) = Store[#return] : &:r31_1, r31_2 +#-----| Goto -> Block 1 + +# 28| Block 1 +# 28| r28_4(glval) = VariableAddress[#return] : +# 28| v28_5(void) = ReturnValue : &:r28_4, ~m? +# 28| v28_6(void) = AliasedUse : ~m? +# 28| v28_7(void) = ExitFunction : + +# 34| Block 2 +# 34| r34_1(glval) = VariableAddress[#return] : +# 34| r34_2(bool) = Constant[0] : +# 34| mu34_3(bool) = Store[#return] : &:r34_1, r34_2 +#-----| Goto -> Block 1 + +# 37| bool consteval_5() +# 37| Block 0 +# 37| v37_1(void) = EnterFunction : +# 37| mu37_2(unknown) = AliasedDefinition : +# 37| mu37_3(unknown) = InitializeNonLocal : +# 39| r39_1(glval) = VariableAddress[r] : +# 39| r39_2(bool) = Constant[1] : +# 39| mu39_3(bool) = Store[r] : &:r39_1, r39_2 +# 42| r42_1(bool) = Constant[0] : +# 42| r42_2(glval) = VariableAddress[r] : +# 42| mu42_3(bool) = Store[r] : &:r42_2, r42_1 +# 45| r45_1(glval) = VariableAddress[#return] : +# 45| r45_2(glval) = VariableAddress[r] : +# 45| r45_3(bool) = Load[r] : &:r45_2, ~m? +# 45| mu45_4(bool) = Store[#return] : &:r45_1, r45_3 +# 37| r37_4(glval) = VariableAddress[#return] : +# 37| v37_5(void) = ReturnValue : &:r37_4, ~m? +# 37| v37_6(void) = AliasedUse : ~m? +# 37| v37_7(void) = ExitFunction : + +# 48| bool consteval_6() +# 48| Block 0 +# 48| v48_1(void) = EnterFunction : +# 48| mu48_2(unknown) = AliasedDefinition : +# 48| mu48_3(unknown) = InitializeNonLocal : +# 50| r50_1(glval) = VariableAddress[r] : +# 50| r50_2(bool) = Constant[1] : +# 50| mu50_3(bool) = Store[r] : &:r50_1, r50_2 +# 52| v52_1(void) = NoOp : +#-----| Goto -> Block 2 + +# 53| Block 1 +# 53| r53_1(bool) = Constant[0] : +# 53| r53_2(glval) = VariableAddress[r] : +# 53| mu53_3(bool) = Store[r] : &:r53_2, r53_1 +#-----| Goto -> Block 2 + +# 56| Block 2 +# 56| r56_1(glval) = VariableAddress[#return] : +# 56| r56_2(glval) = VariableAddress[r] : +# 56| r56_3(bool) = Load[r] : &:r56_2, ~m? +# 56| mu56_4(bool) = Store[#return] : &:r56_1, r56_3 +# 48| r48_4(glval) = VariableAddress[#return] : +# 48| v48_5(void) = ReturnValue : &:r48_4, ~m? +# 48| v48_6(void) = AliasedUse : ~m? +# 48| v48_7(void) = ExitFunction : + many-defs-per-use.cpp: # 34| void many_defs_per_use() # 34| Block 0 From 123f1d599a9282a05c9e54096a19e275553eab04 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Wed, 15 Jan 2025 20:14:46 +0100 Subject: [PATCH 3/8] C++: Add upgrade and downgrade scripts --- .../old.dbscheme | 2429 +++++++++++++++++ .../semmlecode.cpp.dbscheme | 2415 ++++++++++++++++ .../stmts.ql | 17 + .../upgrade.properties | 5 + .../old.dbscheme | 2415 ++++++++++++++++ .../semmlecode.cpp.dbscheme | 2429 +++++++++++++++++ .../upgrade.properties | 2 + 7 files changed, 9712 insertions(+) create mode 100644 cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/old.dbscheme create mode 100644 cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/semmlecode.cpp.dbscheme create mode 100644 cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql create mode 100644 cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/upgrade.properties create mode 100644 cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/old.dbscheme create mode 100644 cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/semmlecode.cpp.dbscheme create mode 100644 cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/upgrade.properties diff --git a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/old.dbscheme b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/old.dbscheme new file mode 100644 index 000000000000..1aa71a4a687f --- /dev/null +++ b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/old.dbscheme @@ -0,0 +1,2429 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +/* +case @fun_requires.kind of + 1 = @template_attached +| 2 = @function_attached +; +*/ + +fun_requires( + int id: @fun_decl ref, + int kind: int ref, + int constraint: @expr ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_specialized(int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); +var_requires( + int id: @var_decl ref, + int constraint: @expr ref +); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); +type_requires( + int id: @type_decl ref, + int constraint: @expr ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of +| 0 = @unknown_usertype +| 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +// ... 6 = @template deprecated +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +| 15 = @template_struct +| 16 = @template_class +| 17 = @template_union +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +nontype_template_parameters( + int id: @expr ref +); + +type_template_type_constraint( + int id: @usertype ref, + int constraint: @expr ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@user_or_decltype = @usertype | @decltype; + +is_proxy_class_for( + unique int id: @usertype ref, + int templ_param_id: @user_or_decltype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +template_template_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +template_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +template_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@concept = @concept_template | @concept_id; + +concept_templates( + unique int concept_id: @concept_template, + string name: string ref, + int location: @location_default ref +); +concept_instantiation( + unique int to: @concept_id ref, + int from: @concept_template ref +); +is_type_constraint(int concept_id: @concept_id ref); +concept_template_argument( + int concept_id: @concept ref, + int index: int ref, + int arg_type: @type ref +); +concept_template_argument_value( + int concept_id: @concept ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl + | @concept_template; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof | @sizeof_pack; + +sizeof_bind( + unique int expr: @sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +| 38 = @stmt_consteval_if +| 39 = @stmt_not_consteval_if +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +@stmt_consteval_or_not_consteval_if = @stmt_consteval_if | @stmt_not_consteval_if; + +consteval_if_then( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int then_id: @stmt ref +); + +consteval_if_else( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/semmlecode.cpp.dbscheme b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/semmlecode.cpp.dbscheme new file mode 100644 index 000000000000..a01d8f91b8d4 --- /dev/null +++ b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/semmlecode.cpp.dbscheme @@ -0,0 +1,2415 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +/* +case @fun_requires.kind of + 1 = @template_attached +| 2 = @function_attached +; +*/ + +fun_requires( + int id: @fun_decl ref, + int kind: int ref, + int constraint: @expr ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_specialized(int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); +var_requires( + int id: @var_decl ref, + int constraint: @expr ref +); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); +type_requires( + int id: @type_decl ref, + int constraint: @expr ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of +| 0 = @unknown_usertype +| 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +// ... 6 = @template deprecated +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +| 15 = @template_struct +| 16 = @template_class +| 17 = @template_union +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +nontype_template_parameters( + int id: @expr ref +); + +type_template_type_constraint( + int id: @usertype ref, + int constraint: @expr ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@user_or_decltype = @usertype | @decltype; + +is_proxy_class_for( + unique int id: @usertype ref, + int templ_param_id: @user_or_decltype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +template_template_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +template_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +template_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@concept = @concept_template | @concept_id; + +concept_templates( + unique int concept_id: @concept_template, + string name: string ref, + int location: @location_default ref +); +concept_instantiation( + unique int to: @concept_id ref, + int from: @concept_template ref +); +is_type_constraint(int concept_id: @concept_id ref); +concept_template_argument( + int concept_id: @concept ref, + int index: int ref, + int arg_type: @type ref +); +concept_template_argument_value( + int concept_id: @concept ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl + | @concept_template; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof | @sizeof_pack; + +sizeof_bind( + unique int expr: @sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql new file mode 100644 index 000000000000..cb15f30808da --- /dev/null +++ b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql @@ -0,0 +1,17 @@ +class Stmt extends @stmt { + string toString() { none() } +} + +class Location extends @location_stmt { + string toString() { none() } +} + +predicate isConstevalIf(Stmt stmt) { + exists(int kind | stmts(stmt, kind, _) | kind = 38 or kind = 39) +} + +from Stmt stmt, int kind, int kind_new, Location location +where + stmts(stmt, kind, location) and + if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statement in it +select stmt, kind_new, location diff --git a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/upgrade.properties b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/upgrade.properties new file mode 100644 index 000000000000..c7e953872d20 --- /dev/null +++ b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/upgrade.properties @@ -0,0 +1,5 @@ +description: Support (not) consteval if +compatibility: full +consteval_if_then.rel: delete +consteval_if_else.rel: delete +stmts.rel: run stmts.qlo \ No newline at end of file diff --git a/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/old.dbscheme b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/old.dbscheme new file mode 100644 index 000000000000..a01d8f91b8d4 --- /dev/null +++ b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/old.dbscheme @@ -0,0 +1,2415 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +/* +case @fun_requires.kind of + 1 = @template_attached +| 2 = @function_attached +; +*/ + +fun_requires( + int id: @fun_decl ref, + int kind: int ref, + int constraint: @expr ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_specialized(int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); +var_requires( + int id: @var_decl ref, + int constraint: @expr ref +); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); +type_requires( + int id: @type_decl ref, + int constraint: @expr ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of +| 0 = @unknown_usertype +| 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +// ... 6 = @template deprecated +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +| 15 = @template_struct +| 16 = @template_class +| 17 = @template_union +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +nontype_template_parameters( + int id: @expr ref +); + +type_template_type_constraint( + int id: @usertype ref, + int constraint: @expr ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@user_or_decltype = @usertype | @decltype; + +is_proxy_class_for( + unique int id: @usertype ref, + int templ_param_id: @user_or_decltype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +template_template_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +template_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +template_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@concept = @concept_template | @concept_id; + +concept_templates( + unique int concept_id: @concept_template, + string name: string ref, + int location: @location_default ref +); +concept_instantiation( + unique int to: @concept_id ref, + int from: @concept_template ref +); +is_type_constraint(int concept_id: @concept_id ref); +concept_template_argument( + int concept_id: @concept ref, + int index: int ref, + int arg_type: @type ref +); +concept_template_argument_value( + int concept_id: @concept ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl + | @concept_template; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof | @sizeof_pack; + +sizeof_bind( + unique int expr: @sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/semmlecode.cpp.dbscheme b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/semmlecode.cpp.dbscheme new file mode 100644 index 000000000000..1aa71a4a687f --- /dev/null +++ b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/semmlecode.cpp.dbscheme @@ -0,0 +1,2429 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +/* +case @fun_requires.kind of + 1 = @template_attached +| 2 = @function_attached +; +*/ + +fun_requires( + int id: @fun_decl ref, + int kind: int ref, + int constraint: @expr ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_specialized(int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); +var_requires( + int id: @var_decl ref, + int constraint: @expr ref +); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); +type_requires( + int id: @type_decl ref, + int constraint: @expr ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of +| 0 = @unknown_usertype +| 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +// ... 6 = @template deprecated +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +| 15 = @template_struct +| 16 = @template_class +| 17 = @template_union +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +nontype_template_parameters( + int id: @expr ref +); + +type_template_type_constraint( + int id: @usertype ref, + int constraint: @expr ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@user_or_decltype = @usertype | @decltype; + +is_proxy_class_for( + unique int id: @usertype ref, + int templ_param_id: @user_or_decltype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +template_template_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +template_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +template_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +@concept = @concept_template | @concept_id; + +concept_templates( + unique int concept_id: @concept_template, + string name: string ref, + int location: @location_default ref +); +concept_instantiation( + unique int to: @concept_id ref, + int from: @concept_template ref +); +is_type_constraint(int concept_id: @concept_id ref); +concept_template_argument( + int concept_id: @concept ref, + int index: int ref, + int arg_type: @type ref +); +concept_template_argument_value( + int concept_id: @concept ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl + | @concept_template; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof | @sizeof_pack; + +sizeof_bind( + unique int expr: @sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +| 38 = @stmt_consteval_if +| 39 = @stmt_not_consteval_if +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +@stmt_consteval_or_not_consteval_if = @stmt_consteval_if | @stmt_not_consteval_if; + +consteval_if_then( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int then_id: @stmt ref +); + +consteval_if_else( + unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/upgrade.properties b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/upgrade.properties new file mode 100644 index 000000000000..9532d09dafb9 --- /dev/null +++ b/cpp/ql/lib/upgrades/a01d8f91b8d49259e509b574962dec90719f69a6/upgrade.properties @@ -0,0 +1,2 @@ +description: Support (not) consteval if +compatibility: partial From 4a3350bd41e8657d609f79162377e9e2303b0bff Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 16 Jan 2025 00:05:02 +0100 Subject: [PATCH 4/8] C++: Update stats file --- cpp/ql/lib/semmlecode.cpp.dbscheme.stats | 2537 +++++++++++----------- 1 file changed, 1323 insertions(+), 1214 deletions(-) diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats index 37009a1036aa..3ab1cfe3d8b3 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats @@ -2,7 +2,7 @@ @compilation - 16220 + 16215 @externalDataElement @@ -18,15 +18,15 @@ @location_default - 31650369 + 31650399 @location_stmt - 5202904 + 5202909 @location_expr - 17958922 + 17958939 @diagnostic @@ -34,35 +34,35 @@ @file - 83663 + 83639 @folder - 15895 + 15890 @macro_expansion - 40310793 + 40298969 @other_macro_reference - 314184 + 314185 @function - 3356875 + 3356878 @fun_decl - 3388839 + 3388842 @var_decl - 6734227 + 6733964 @type_decl - 1891825 + 1891257 @namespace_decl @@ -86,19 +86,19 @@ @parameter - 4798868 + 4798873 @membervariable - 1441779 + 1441780 @globalvariable - 425545 + 425544 @localvariable - 735323 + 735326 @enumconstant @@ -334,7 +334,7 @@ @type_with_specifiers - 725882 + 725883 @array @@ -346,7 +346,7 @@ @reference - 1024846 + 1024847 @gnu_vector @@ -366,19 +366,19 @@ @decltype - 22074 + 22068 @usertype - 4993578 + 4992114 @mangledname - 5808003 + 5808008 @type_mention - 5507859 + 5507864 @concept_template @@ -386,11 +386,11 @@ @routinetype - 762068 + 762069 @ptrtomember - 12087 + 12083 @specifier @@ -402,11 +402,11 @@ @stdattribute - 346324 + 346325 @declspec - 326924 + 326925 @msattribute @@ -422,11 +422,11 @@ @attribute_arg_constant_expr - 89585 + 89532 @attribute_arg_expr - 1802 + 1801 @attribute_arg_empty @@ -442,7 +442,7 @@ @derivation - 599885 + 599886 @frienddecl @@ -450,11 +450,11 @@ @comment - 11290133 + 11290144 @namespace - 11098 + 11095 @specialnamequalifyingelement @@ -462,15 +462,15 @@ @namequalifier - 3258067 + 3258071 @value - 14099251 + 14099264 @initialiser - 2336670 + 2336672 @address_of @@ -478,19 +478,19 @@ @indirect - 399727 + 399728 @array_to_pointer - 1951447 + 1951449 @parexpr - 4895378 + 4895383 @arithnegexpr - 585842 + 585843 @unaryplusexpr @@ -506,7 +506,7 @@ @postincrexpr - 84816 + 84817 @postdecrexpr @@ -522,7 +522,7 @@ @conditionalexpr - 896444 + 896445 @addexpr @@ -530,7 +530,7 @@ @subexpr - 466248 + 466249 @mulexpr @@ -538,7 +538,7 @@ @divexpr - 60369 + 60351 @remexpr @@ -566,7 +566,7 @@ @andexpr - 536665 + 536666 @orexpr @@ -578,15 +578,15 @@ @eqexpr - 641621 + 641622 @neexpr - 411384 + 411385 @gtexpr - 110846 + 110847 @ltexpr @@ -602,7 +602,7 @@ @assignexpr - 1277658 + 1277660 @assignaddexpr @@ -614,7 +614,7 @@ @assignmulexpr - 14133 + 14129 @assigndivexpr @@ -658,7 +658,7 @@ @orlogicalexpr - 1203317 + 1203318 @commaexpr @@ -666,7 +666,7 @@ @subscriptexpr - 433958 + 433959 @callexpr @@ -690,11 +690,11 @@ @varaccess - 8226108 + 8226116 @runtime_sizeof - 397855 + 397856 @runtime_alignof @@ -706,11 +706,11 @@ @routineexpr - 6144490 + 6144496 @type_operand - 1532454 + 1532455 @offsetofexpr @@ -722,7 +722,7 @@ @literal - 6101418 + 6101421 @aggregateliteral @@ -730,11 +730,11 @@ @c_style_cast - 6024777 + 6024778 @temp_init - 1076245 + 1075849 @errorexpr @@ -742,11 +742,11 @@ @reference_to - 2194481 + 2194483 @ref_indirect - 2657402 + 2657405 @vacuous_destructor_call @@ -806,7 +806,7 @@ @thisaccess - 1525360 + 1525361 @new_expr @@ -818,7 +818,7 @@ @throw_expr - 26183 + 26214 @condition_decl @@ -826,7 +826,7 @@ @braced_init_list - 2335 + 2334 @type_id @@ -922,11 +922,11 @@ @uuidof - 27727 + 27728 @delete_array_expr - 1599 + 1598 @new_array_expr @@ -966,7 +966,7 @@ @static_cast - 335576 + 335478 @reinterpret_cast @@ -986,11 +986,11 @@ @param_ref - 178121 + 177918 @noopexpr - 121 + 52 @istriviallyconstructibleexpr @@ -1090,7 +1090,7 @@ @noexceptexpr - 30904 + 30759 @builtinshufflevector @@ -1262,7 +1262,7 @@ @reuseexpr - 907883 + 907884 @istriviallycopyassignable @@ -1382,11 +1382,11 @@ @stmt_expr - 2026086 + 2026088 @stmt_if - 987520 + 987521 @stmt_while @@ -1394,7 +1394,7 @@ @stmt_goto - 151171 + 151172 @stmt_label @@ -1402,11 +1402,11 @@ @stmt_return - 1515846 + 1515847 @stmt_block - 1897789 + 1897791 @stmt_end_test_while @@ -1418,11 +1418,11 @@ @stmt_switch_case - 896214 + 896215 @stmt_switch - 441453 + 441454 @stmt_asm @@ -1430,7 +1430,7 @@ @stmt_decl - 771118 + 770892 @stmt_empty @@ -1446,7 +1446,7 @@ @stmt_try_block - 28964 + 29027 @stmt_microsoft_try @@ -1470,7 +1470,7 @@ @stmt_handler - 47466 + 47521 @stmt_constexpr_if @@ -1480,9 +1480,17 @@ @stmt_co_return 5 + + @stmt_consteval_if + 3 + + + @stmt_not_consteval_if + 3 + @ppd_if - 511548 + 511549 @ppd_ifdef @@ -1490,11 +1498,11 @@ @ppd_ifndef - 154177 + 154178 @ppd_elif - 28118 + 28110 @ppd_else @@ -1502,15 +1510,15 @@ @ppd_endif - 846302 + 846303 @ppd_plain_include - 402084 + 401966 @ppd_define - 3130377 + 3130380 @ppd_undef @@ -1572,11 +1580,11 @@ compilations - 16220 + 16215 id - 16220 + 16215 cwd @@ -1594,7 +1602,7 @@ 1 2 - 16220 + 16215 @@ -1620,11 +1628,11 @@ compilation_args - 1298604 + 1298223 id - 16220 + 16215 num @@ -1632,7 +1640,7 @@ arg - 37549 + 37538 @@ -1646,12 +1654,12 @@ 36 42 - 1287 + 1286 42 43 - 1409 + 1408 43 @@ -1701,7 +1709,7 @@ 103 104 - 2561 + 2560 104 @@ -1737,12 +1745,12 @@ 38 39 - 1924 + 1923 39 40 - 1260 + 1259 40 @@ -1772,7 +1780,7 @@ 67 68 - 1802 + 1801 68 @@ -1782,7 +1790,7 @@ 70 71 - 1802 + 1801 73 @@ -1960,22 +1968,22 @@ 1 2 - 17196 + 17191 2 3 - 16274 + 16269 3 103 - 2818 + 2817 104 1198 - 1260 + 1259 @@ -1991,12 +1999,12 @@ 1 2 - 24866 + 24858 2 3 - 11193 + 11189 3 @@ -2011,11 +2019,11 @@ compilation_build_mode - 16220 + 16215 id - 16220 + 16215 mode @@ -2033,7 +2041,7 @@ 1 2 - 16220 + 16215 @@ -2059,11 +2067,11 @@ compilation_compiling_files - 16220 + 16215 id - 16220 + 16215 num @@ -2071,7 +2079,7 @@ file - 7425 + 7423 @@ -2085,7 +2093,7 @@ 1 2 - 16220 + 16215 @@ -2101,7 +2109,7 @@ 1 2 - 16220 + 16215 @@ -2154,7 +2162,7 @@ 2 3 - 7222 + 7220 28 @@ -2175,7 +2183,7 @@ 1 2 - 7425 + 7423 @@ -2185,11 +2193,11 @@ compilation_time - 64611 + 64592 id - 16152 + 16148 num @@ -2201,7 +2209,7 @@ seconds - 17453 + 17638 @@ -2215,7 +2223,7 @@ 1 2 - 16152 + 16148 @@ -2231,7 +2239,7 @@ 4 5 - 16152 + 16148 @@ -2247,17 +2255,17 @@ 2 3 - 121 + 67 3 4 - 8401 + 8331 4 5 - 7629 + 7748 @@ -2303,8 +2311,8 @@ 12 - 1288 - 1289 + 1302 + 1303 13 @@ -2361,13 +2369,13 @@ 13 - 709 - 710 + 720 + 721 13 - 780 - 781 + 784 + 785 13 @@ -2384,27 +2392,27 @@ 1 2 - 10922 + 11067 2 3 - 3726 + 3644 3 4 - 1355 + 1571 4 - 23 - 1314 + 215 + 1327 - 24 - 691 - 135 + 658 + 694 + 27 @@ -2420,7 +2428,7 @@ 1 2 - 17453 + 17638 @@ -2436,17 +2444,17 @@ 1 2 - 14513 + 14644 2 3 - 2899 + 2980 3 - 5 - 40 + 4 + 13 @@ -2702,19 +2710,19 @@ compilation_finished - 16220 + 16215 id - 16220 + 16215 cpu_seconds - 11965 + 11907 elapsed_seconds - 230 + 257 @@ -2728,7 +2736,7 @@ 1 2 - 16220 + 16215 @@ -2744,7 +2752,7 @@ 1 2 - 16220 + 16215 @@ -2760,17 +2768,17 @@ 1 2 - 10000 + 9740 2 3 - 1382 + 1598 3 - 30 - 582 + 37 + 568 @@ -2786,12 +2794,12 @@ 1 2 - 11315 + 11040 2 3 - 650 + 867 @@ -2807,12 +2815,12 @@ 1 2 - 27 + 54 2 3 - 13 + 27 3 @@ -2820,18 +2828,8 @@ 13 - 4 - 5 - 13 - - - 7 - 8 - 13 - - - 9 - 10 + 6 + 7 13 @@ -2840,48 +2838,48 @@ 13 - 13 - 14 - 13 + 12 + 13 + 27 - 19 - 20 + 18 + 19 13 - 20 - 21 + 21 + 22 13 - 22 - 23 + 23 + 24 13 - 36 - 37 + 35 + 36 13 - 136 - 137 + 139 + 140 13 - 267 - 268 + 278 + 279 13 - 308 - 309 + 295 + 296 13 - 339 - 340 + 337 + 338 13 @@ -2898,12 +2896,12 @@ 1 2 - 27 + 54 2 3 - 13 + 27 3 @@ -2911,18 +2909,8 @@ 13 - 4 - 5 - 13 - - - 7 - 8 - 13 - - - 9 - 10 + 6 + 7 13 @@ -2931,48 +2919,48 @@ 13 - 13 - 14 - 13 + 12 + 13 + 27 - 19 - 20 + 18 + 19 13 - 20 - 21 + 21 + 22 13 - 21 - 22 + 22 + 23 13 - 35 - 36 + 34 + 35 13 - 128 - 129 + 137 + 138 13 - 160 - 161 + 169 + 170 13 - 240 - 241 + 243 + 244 13 - 258 - 259 + 248 + 249 13 @@ -4745,11 +4733,11 @@ locations_default - 31650369 + 31650399 id - 31650369 + 31650399 container @@ -4757,7 +4745,7 @@ startLine - 7709291 + 7709298 startColumn @@ -4765,7 +4753,7 @@ endLine - 7708618 + 7708625 endColumn @@ -4783,7 +4771,7 @@ 1 2 - 31650369 + 31650399 @@ -4799,7 +4787,7 @@ 1 2 - 31650369 + 31650399 @@ -4815,7 +4803,7 @@ 1 2 - 31650369 + 31650399 @@ -4831,7 +4819,7 @@ 1 2 - 31650369 + 31650399 @@ -4847,7 +4835,7 @@ 1 2 - 31650369 + 31650399 @@ -5248,12 +5236,12 @@ 1 2 - 5187067 + 5187072 2 3 - 787639 + 787640 3 @@ -5284,12 +5272,12 @@ 1 2 - 5247613 + 5247618 2 3 - 1198816 + 1198817 3 @@ -5320,7 +5308,7 @@ 1 2 - 5929499 + 5929505 2 @@ -5330,7 +5318,7 @@ 3 5 - 581378 + 581379 5 @@ -5356,7 +5344,7 @@ 1 2 - 7561423 + 7561431 2 @@ -5377,7 +5365,7 @@ 1 2 - 5256090 + 5256095 2 @@ -5387,7 +5375,7 @@ 3 4 - 626990 + 626991 4 @@ -5793,12 +5781,12 @@ 1 2 - 5183434 + 5183439 2 3 - 792887 + 792888 3 @@ -5808,12 +5796,12 @@ 4 9 - 579629 + 579630 9 412 - 522043 + 522044 @@ -5829,17 +5817,17 @@ 1 2 - 5242904 + 5242909 2 3 - 1200969 + 1200970 3 5 - 638830 + 638831 5 @@ -5865,12 +5853,12 @@ 1 2 - 7548103 + 7548110 2 7 - 160514 + 160515 @@ -5886,17 +5874,17 @@ 1 2 - 5929634 + 5929639 2 3 - 579091 + 579092 3 5 - 581378 + 581379 5 @@ -5922,12 +5910,12 @@ 1 2 - 5253130 + 5253135 2 3 - 768937 + 768938 3 @@ -5942,7 +5930,7 @@ 10 225 - 462169 + 462170 @@ -6272,11 +6260,11 @@ locations_stmt - 5202904 + 5202909 id - 5202904 + 5202909 container @@ -6284,7 +6272,7 @@ startLine - 272851 + 272852 startColumn @@ -6310,7 +6298,7 @@ 1 2 - 5202904 + 5202909 @@ -6326,7 +6314,7 @@ 1 2 - 5202904 + 5202909 @@ -6342,7 +6330,7 @@ 1 2 - 5202904 + 5202909 @@ -6358,7 +6346,7 @@ 1 2 - 5202904 + 5202909 @@ -6374,7 +6362,7 @@ 1 2 - 5202904 + 5202909 @@ -8264,11 +8252,11 @@ locations_expr - 17958922 + 17958939 id - 17958922 + 17958939 container @@ -8276,7 +8264,7 @@ startLine - 262019 + 262020 startColumn @@ -8284,7 +8272,7 @@ endLine - 261991 + 261992 endColumn @@ -8302,7 +8290,7 @@ 1 2 - 17958922 + 17958939 @@ -8318,7 +8306,7 @@ 1 2 - 17958922 + 17958939 @@ -8334,7 +8322,7 @@ 1 2 - 17958922 + 17958939 @@ -8350,7 +8338,7 @@ 1 2 - 17958922 + 17958939 @@ -8366,7 +8354,7 @@ 1 2 - 17958922 + 17958939 @@ -9010,7 +8998,7 @@ 3 4 - 37687 + 37688 4 @@ -10191,11 +10179,11 @@ numlines - 860968 + 860969 element_id - 859622 + 859623 num_lines @@ -10221,7 +10209,7 @@ 1 2 - 858277 + 858278 2 @@ -10242,7 +10230,7 @@ 1 2 - 858277 + 858278 2 @@ -10263,7 +10251,7 @@ 1 2 - 859353 + 859354 2 @@ -11179,15 +11167,15 @@ files - 83663 + 83639 id - 83663 + 83639 name - 83663 + 83639 @@ -11201,7 +11189,7 @@ 1 2 - 83663 + 83639 @@ -11217,7 +11205,7 @@ 1 2 - 83663 + 83639 @@ -11227,15 +11215,15 @@ folders - 15895 + 15890 id - 15895 + 15890 name - 15895 + 15890 @@ -11249,7 +11237,7 @@ 1 2 - 15895 + 15890 @@ -11265,7 +11253,7 @@ 1 2 - 15895 + 15890 @@ -11275,15 +11263,15 @@ containerparent - 99531 + 99502 parent - 15895 + 15890 child - 99531 + 99502 @@ -11297,12 +11285,12 @@ 1 2 - 7737 + 7735 2 3 - 1951 + 1950 3 @@ -11312,7 +11300,7 @@ 4 6 - 1287 + 1286 6 @@ -11322,7 +11310,7 @@ 10 16 - 1287 + 1286 16 @@ -11348,7 +11336,7 @@ 1 2 - 99531 + 99502 @@ -11358,11 +11346,11 @@ fileannotations - 5389037 + 5387456 id - 7398 + 7396 kind @@ -11370,11 +11358,11 @@ name - 75329 + 75307 value - 50694 + 50679 @@ -11393,7 +11381,7 @@ 2 3 - 7141 + 7139 @@ -11419,7 +11407,7 @@ 212 291 - 569 + 568 291 @@ -11444,7 +11432,7 @@ 550 551 - 1707 + 1706 553 @@ -11459,7 +11447,7 @@ 753 1231 - 569 + 568 1234 @@ -11495,12 +11483,12 @@ 352 434 - 569 + 568 434 490 - 569 + 568 490 @@ -11515,7 +11503,7 @@ 706 707 - 1707 + 1706 710 @@ -11619,62 +11607,62 @@ 1 2 - 14147 + 14143 2 3 - 5596 + 5594 3 5 - 6490 + 6489 5 7 - 5257 + 5256 7 9 - 5894 + 5892 9 16 - 5555 + 5554 16 19 - 6274 + 6272 19 27 - 5461 + 5459 27 47 - 6206 + 6204 47 128 - 6314 + 6312 128 459 - 5935 + 5933 459 546 - 2195 + 2194 @@ -11690,7 +11678,7 @@ 1 2 - 75329 + 75307 @@ -11706,57 +11694,57 @@ 1 2 - 14865 + 14861 2 3 - 9865 + 9862 3 4 - 5257 + 5256 4 6 - 5217 + 5215 6 8 - 4390 + 4389 8 11 - 6084 + 6082 11 17 - 6924 + 6922 17 23 - 6030 + 6028 23 41 - 6003 + 6001 41 95 - 5732 + 5730 95 1726 - 4959 + 4958 @@ -11772,27 +11760,27 @@ 1 2 - 4309 + 4307 2 4 - 2100 + 2099 4 5 - 4092 + 4091 5 8 - 3157 + 3156 8 14 - 3807 + 3806 14 @@ -11802,42 +11790,42 @@ 17 24 - 3902 + 3901 24 51 - 4539 + 4538 51 58 - 3889 + 3887 58 80 - 3821 + 3820 81 151 - 3956 + 3955 151 334 - 3821 + 3820 334 473 - 3848 + 3847 473 547 - 2967 + 2966 @@ -11853,7 +11841,7 @@ 1 2 - 50680 + 50665 2 @@ -11874,7 +11862,7 @@ 1 2 - 4363 + 4362 2 @@ -11884,57 +11872,57 @@ 4 5 - 3916 + 3915 5 8 - 3184 + 3183 8 14 - 4471 + 4470 14 18 - 4431 + 4429 18 28 - 4105 + 4104 28 34 - 4038 + 4037 34 41 - 4105 + 4104 41 66 - 3834 + 3833 66 92 - 3943 + 3942 92 113 - 3834 + 3833 113 145 - 3889 + 3887 145 @@ -11949,15 +11937,15 @@ inmacroexpansion - 149742248 + 149742391 id - 24596893 + 24596917 inv - 3698097 + 3698100 @@ -11971,32 +11959,32 @@ 1 3 - 2167548 + 2167550 3 5 - 1469287 + 1469288 5 6 - 1617555 + 1617557 6 7 - 6573992 + 6573998 7 8 - 8708719 + 8708727 8 9 - 3552854 + 3552857 9 @@ -12027,7 +12015,7 @@ 3 4 - 479644 + 479645 4 @@ -12037,7 +12025,7 @@ 7 8 - 282495 + 282496 8 @@ -12077,15 +12065,15 @@ affectedbymacroexpansion - 48676734 + 48676781 id - 7035601 + 7035608 inv - 3798614 + 3798617 @@ -12099,12 +12087,12 @@ 1 2 - 3842143 + 3842146 2 3 - 764599 + 764600 3 @@ -12114,7 +12102,7 @@ 4 5 - 771825 + 771826 5 @@ -12124,7 +12112,7 @@ 12 50 - 555611 + 555612 50 @@ -12160,22 +12148,22 @@ 9 12 - 342528 + 342529 12 13 - 455466 + 455467 13 14 - 225832 + 225833 14 15 - 407557 + 407558 15 @@ -12195,12 +12183,12 @@ 18 20 - 343849 + 343850 20 25 - 285056 + 285057 25 @@ -12215,19 +12203,19 @@ macroinvocations - 40612966 + 40601054 id - 40612966 + 40601054 macro_id - 109939 + 109906 location - 1070405 + 1070091 kind @@ -12245,7 +12233,7 @@ 1 2 - 40612966 + 40601054 @@ -12261,7 +12249,7 @@ 1 2 - 40612966 + 40601054 @@ -12277,7 +12265,7 @@ 1 2 - 40612966 + 40601054 @@ -12293,52 +12281,52 @@ 1 2 - 23524 + 23517 2 3 - 20434 + 20428 3 4 - 7493 + 7491 4 6 - 10109 + 10106 6 11 - 9458 + 9455 11 21 - 9187 + 9184 21 48 - 8252 + 8250 48 145 - 8306 + 8304 145 952 - 8252 + 8250 954 175299 - 4919 + 4917 @@ -12354,37 +12342,37 @@ 1 2 - 60274 + 60257 2 3 - 13645 + 13641 3 4 - 6883 + 6881 4 6 - 8726 + 8724 6 13 - 9445 + 9442 13 67 - 8293 + 8290 67 4815 - 2669 + 2668 @@ -12400,12 +12388,12 @@ 1 2 - 101483 + 101453 2 3 - 8455 + 8453 @@ -12421,37 +12409,37 @@ 1 2 - 426734 + 426608 2 3 - 252793 + 252719 3 4 - 113245 + 113212 4 6 - 77498 + 77475 6 11 - 82782 + 82758 11 42 - 80479 + 80455 42 226288 - 36872 + 36861 @@ -12467,12 +12455,12 @@ 1 2 - 1009941 + 1009645 2 367 - 60464 + 60446 @@ -12488,7 +12476,7 @@ 1 2 - 1070405 + 1070091 @@ -12561,15 +12549,15 @@ macroparent - 35821338 + 35810831 id - 35821338 + 35810831 parent_id - 28068155 + 28059922 @@ -12583,7 +12571,7 @@ 1 2 - 35821338 + 35810831 @@ -12599,17 +12587,17 @@ 1 2 - 21864284 + 21857871 2 3 - 5175771 + 5174253 3 91 - 1028099 + 1027798 @@ -12619,15 +12607,15 @@ macrolocationbind - 5543849 + 5543855 id - 3882183 + 3882187 location - 2758857 + 2758859 @@ -12641,7 +12629,7 @@ 1 2 - 3056758 + 3056761 2 @@ -12651,7 +12639,7 @@ 3 7 - 314961 + 314962 7 @@ -12672,12 +12660,12 @@ 1 2 - 2198773 + 2198775 2 3 - 239729 + 239730 3 @@ -12697,11 +12685,11 @@ macro_argument_unexpanded - 103282208 + 103251914 invocation - 31235129 + 31225967 argument_index @@ -12709,7 +12697,7 @@ text - 440393 + 440264 @@ -12723,22 +12711,22 @@ 1 2 - 9982360 + 9979432 2 3 - 12508684 + 12505015 3 4 - 6397365 + 6395489 4 67 - 2346718 + 2346030 @@ -12754,22 +12742,22 @@ 1 2 - 10216670 + 10213673 2 3 - 12530189 + 12526514 3 4 - 6197394 + 6195576 4 67 - 2290875 + 2290203 @@ -12837,57 +12825,57 @@ 1 2 - 52035 + 52020 2 3 - 80018 + 79995 3 4 - 29690 + 29681 4 5 - 44460 + 44447 5 6 - 50233 + 50218 6 9 - 36601 + 36590 9 15 - 36858 + 36847 15 27 - 33525 + 33515 27 57 - 34134 + 34124 57 517 - 33254 + 33244 518 485091 - 9580 + 9577 @@ -12903,17 +12891,17 @@ 1 2 - 311984 + 311892 2 3 - 115305 + 115271 3 9 - 13103 + 13099 @@ -12923,11 +12911,11 @@ macro_argument_expanded - 103282208 + 103251914 invocation - 31235129 + 31225967 argument_index @@ -12935,7 +12923,7 @@ text - 266764 + 266686 @@ -12949,22 +12937,22 @@ 1 2 - 9982360 + 9979432 2 3 - 12508684 + 12505015 3 4 - 6397365 + 6395489 4 67 - 2346718 + 2346030 @@ -12980,22 +12968,22 @@ 1 2 - 13767109 + 13763071 2 3 - 10792871 + 10789706 3 4 - 5405555 + 5403970 4 9 - 1269591 + 1269219 @@ -13063,57 +13051,57 @@ 1 2 - 28308 + 28299 2 3 - 35164 + 35154 3 4 - 58526 + 58509 4 5 - 20570 + 20564 5 6 - 3997 + 3996 6 7 - 23321 + 23314 7 10 - 21776 + 21770 10 19 - 22955 + 22948 19 51 - 20082 + 20076 51 253 - 20096 + 20090 254 990266 - 11965 + 11962 @@ -13129,17 +13117,17 @@ 1 2 - 134818 + 134779 2 3 - 114072 + 114038 3 66 - 17873 + 17868 @@ -13149,15 +13137,15 @@ functions - 3356875 + 3356878 id - 3356875 + 3356878 name - 466658 + 466659 kind @@ -13175,7 +13163,7 @@ 1 2 - 3356875 + 3356878 @@ -13191,7 +13179,7 @@ 1 2 - 3356875 + 3356878 @@ -13207,7 +13195,7 @@ 1 2 - 372699 + 372700 2 @@ -13238,7 +13226,7 @@ 1 2 - 465412 + 465413 2 @@ -13355,15 +13343,15 @@ function_entry_point - 1438642 + 1438643 id - 1433916 + 1433917 entry_point - 1438642 + 1438643 @@ -13377,7 +13365,7 @@ 1 2 - 1429878 + 1429879 2 @@ -13398,7 +13386,7 @@ 1 2 - 1438642 + 1438643 @@ -13408,15 +13396,15 @@ function_return_type - 3363190 + 3363194 id - 3356875 + 3356878 return_type - 631806 + 631807 @@ -13430,7 +13418,7 @@ 1 2 - 3351075 + 3351078 2 @@ -13451,12 +13439,12 @@ 1 2 - 436971 + 436972 2 3 - 120423 + 120424 3 @@ -13779,11 +13767,11 @@ function_prototyped - 3352750 + 3352754 id - 3352750 + 3352754 @@ -13863,11 +13851,11 @@ member_function_this_type - 674425 + 674426 id - 674425 + 674426 this_type @@ -13885,7 +13873,7 @@ 1 2 - 674425 + 674426 @@ -13936,27 +13924,27 @@ fun_decls - 3392749 + 3392752 id - 3388839 + 3388842 function - 3232284 + 3232287 type_id - 600787 + 600788 name - 462018 + 462019 location - 932372 + 932373 @@ -13970,7 +13958,7 @@ 1 2 - 3388839 + 3388842 @@ -13986,7 +13974,7 @@ 1 2 - 3385445 + 3385448 2 @@ -14007,7 +13995,7 @@ 1 2 - 3388839 + 3388842 @@ -14023,7 +14011,7 @@ 1 2 - 3388839 + 3388842 @@ -14039,7 +14027,7 @@ 1 2 - 3101892 + 3101895 2 @@ -14060,7 +14048,7 @@ 1 2 - 3221930 + 3221933 2 @@ -14081,7 +14069,7 @@ 1 2 - 3232284 + 3232287 @@ -14097,7 +14085,7 @@ 1 2 - 3146960 + 3146963 2 @@ -14123,7 +14111,7 @@ 2 3 - 127254 + 127255 3 @@ -14211,7 +14199,7 @@ 1 2 - 441310 + 441311 2 @@ -14278,7 +14266,7 @@ 1 2 - 369348 + 369349 2 @@ -14309,7 +14297,7 @@ 1 2 - 427519 + 427520 2 @@ -14330,7 +14318,7 @@ 1 2 - 355514 + 355515 2 @@ -14361,7 +14349,7 @@ 1 2 - 736892 + 736893 2 @@ -14423,7 +14411,7 @@ 1 2 - 854395 + 854396 2 @@ -14449,7 +14437,7 @@ 1 2 - 884769 + 884770 2 @@ -14464,11 +14452,11 @@ fun_def - 1592190 + 1592191 id - 1592190 + 1592191 @@ -14497,11 +14485,11 @@ fun_decl_specifiers - 1763133 + 1763134 id - 1197759 + 1197760 name @@ -14519,7 +14507,7 @@ 1 2 - 640796 + 640797 2 @@ -14691,22 +14679,22 @@ fun_decl_empty_throws - 435234 + 435235 fun_decl - 435234 + 435235 fun_decl_noexcept - 178852 + 178853 fun_decl - 178852 + 178853 constant @@ -14724,7 +14712,7 @@ 1 2 - 178852 + 178853 @@ -14740,7 +14728,7 @@ 1 2 - 177692 + 177693 2 @@ -14755,11 +14743,11 @@ fun_decl_empty_noexcept - 1063865 + 1063866 fun_decl - 1063865 + 1063866 @@ -15025,11 +15013,11 @@ param_decl_bind - 4870874 + 4870878 id - 4870874 + 4870878 index @@ -15037,7 +15025,7 @@ fun_decl - 2664663 + 2664665 @@ -15051,7 +15039,7 @@ 1 2 - 4870874 + 4870878 @@ -15067,7 +15055,7 @@ 1 2 - 4870874 + 4870878 @@ -15245,7 +15233,7 @@ 1 2 - 1370804 + 1370805 2 @@ -15276,7 +15264,7 @@ 1 2 - 1370804 + 1370805 2 @@ -15301,27 +15289,27 @@ var_decls - 6739205 + 6738942 id - 6734227 + 6733964 variable - 6565773 + 6565780 type_id - 1513118 + 1513120 name - 829080 + 829081 location - 3605464 + 3605467 @@ -15335,7 +15323,7 @@ 1 2 - 6734227 + 6733964 @@ -15351,7 +15339,7 @@ 1 2 - 6729248 + 6728986 2 @@ -15372,7 +15360,7 @@ 1 2 - 6734227 + 6733964 @@ -15388,7 +15376,7 @@ 1 2 - 6734227 + 6733964 @@ -15404,12 +15392,12 @@ 1 2 - 6408488 + 6408763 2 4 - 157285 + 157016 @@ -15425,7 +15413,7 @@ 1 2 - 6551242 + 6551248 2 @@ -15446,7 +15434,7 @@ 1 2 - 6548551 + 6548558 2 @@ -15467,7 +15455,7 @@ 1 2 - 6434724 + 6434730 2 @@ -15488,7 +15476,7 @@ 1 2 - 890164 + 890165 2 @@ -15503,7 +15491,7 @@ 5 12 - 116517 + 116518 12 @@ -15524,7 +15512,7 @@ 1 2 - 909405 + 909406 2 @@ -15560,7 +15548,7 @@ 1 2 - 1159932 + 1159933 2 @@ -15591,12 +15579,12 @@ 1 2 - 1026326 + 1026327 2 3 - 228595 + 228596 3 @@ -15642,7 +15630,7 @@ 4 7 - 65389 + 65390 7 @@ -15651,7 +15639,7 @@ 28 - 6411 + 6409 27716 @@ -15673,7 +15661,7 @@ 2 3 - 156343 + 156344 3 @@ -15740,7 +15728,7 @@ 1 2 - 487733 + 487734 2 @@ -15776,7 +15764,7 @@ 1 2 - 3120824 + 3120827 2 @@ -15785,7 +15773,7 @@ 4 - 2760 + 2758 194017 @@ -15802,7 +15790,7 @@ 1 2 - 3145715 + 3145718 2 @@ -15828,7 +15816,7 @@ 1 2 - 3312958 + 3312961 2 @@ -15854,7 +15842,7 @@ 1 2 - 3594431 + 3594434 2 @@ -15869,11 +15857,11 @@ var_def - 3747411 + 3747415 id - 3747411 + 3747415 @@ -16023,19 +16011,19 @@ type_decls - 1891825 + 1891257 id - 1891825 + 1891257 type_id - 1849899 + 1849356 location - 1485946 + 1485510 @@ -16049,7 +16037,7 @@ 1 2 - 1891825 + 1891257 @@ -16065,7 +16053,7 @@ 1 2 - 1891825 + 1891257 @@ -16081,12 +16069,12 @@ 1 2 - 1819816 + 1819282 2 24 - 30083 + 30074 @@ -16102,12 +16090,12 @@ 1 2 - 1821428 + 1820894 2 24 - 28470 + 28462 @@ -16123,12 +16111,12 @@ 1 2 - 1408923 + 1408509 2 651 - 77023 + 77001 @@ -16144,12 +16132,12 @@ 1 2 - 1410738 + 1410325 2 651 - 75207 + 75185 @@ -16159,11 +16147,11 @@ type_def - 1298238 + 1297857 id - 1298238 + 1297857 @@ -16698,7 +16686,7 @@ 1 2 - 105215 + 105216 2 @@ -16719,7 +16707,7 @@ 1 2 - 105215 + 105216 2 @@ -17587,15 +17575,15 @@ params - 4808535 + 4808540 id - 4798868 + 4798873 function - 2659164 + 2659166 index @@ -17603,7 +17591,7 @@ type_id - 862085 + 862086 @@ -17617,7 +17605,7 @@ 1 2 - 4798868 + 4798873 @@ -17633,7 +17621,7 @@ 1 2 - 4798868 + 4798873 @@ -17649,7 +17637,7 @@ 1 2 - 4789545 + 4789550 2 @@ -17670,12 +17658,12 @@ 1 2 - 1392114 + 1392115 2 3 - 661149 + 661150 3 @@ -17685,7 +17673,7 @@ 4 21 - 166307 + 166308 @@ -17701,12 +17689,12 @@ 1 2 - 1392114 + 1392115 2 3 - 661149 + 661150 3 @@ -17716,7 +17704,7 @@ 4 21 - 166307 + 166308 @@ -17732,7 +17720,7 @@ 1 2 - 1481046 + 1481047 2 @@ -17747,7 +17735,7 @@ 4 10 - 104355 + 104356 @@ -18006,12 +17994,12 @@ 1 2 - 449172 + 449173 2 3 - 180012 + 180013 3 @@ -18047,7 +18035,7 @@ 1 2 - 492092 + 492093 2 @@ -18186,11 +18174,11 @@ membervariables - 1444236 + 1444238 id - 1441779 + 1441780 type_id @@ -18198,7 +18186,7 @@ name - 617366 + 617367 @@ -18212,7 +18200,7 @@ 1 2 - 1439430 + 1439432 2 @@ -18233,7 +18221,7 @@ 1 2 - 1441779 + 1441780 @@ -18280,7 +18268,7 @@ 1 2 - 348934 + 348935 2 @@ -18316,12 +18304,12 @@ 2 3 - 118295 + 118296 3 5 - 56307 + 56308 5 @@ -18362,15 +18350,15 @@ globalvariables - 425556 + 425555 id - 425545 + 425544 type_id - 1633 + 1632 name @@ -18388,7 +18376,7 @@ 1 2 - 425534 + 425533 2 @@ -18409,7 +18397,7 @@ 1 2 - 425545 + 425544 @@ -18425,7 +18413,7 @@ 1 2 - 1146 + 1145 2 @@ -18461,7 +18449,7 @@ 1 2 - 1178 + 1177 2 @@ -18497,12 +18485,12 @@ 1 2 - 399363 + 399364 2 1044 - 5651 + 5650 @@ -18518,12 +18506,12 @@ 1 2 - 404350 + 404351 2 15 - 664 + 663 @@ -18533,19 +18521,19 @@ localvariables - 735323 + 735326 id - 735323 + 735326 type_id - 54078 + 54082 name - 102826 + 102827 @@ -18559,7 +18547,7 @@ 1 2 - 735323 + 735326 @@ -18575,7 +18563,7 @@ 1 2 - 735323 + 735326 @@ -18591,12 +18579,12 @@ 1 2 - 29229 + 29233 2 3 - 7925 + 7926 3 @@ -18637,7 +18625,7 @@ 1 2 - 38830 + 38835 2 @@ -18668,7 +18656,7 @@ 1 2 - 63261 + 63262 2 @@ -19568,7 +19556,7 @@ 1 2 - 329600 + 329601 2 @@ -19589,7 +19577,7 @@ 1 2 - 329600 + 329601 2 @@ -19642,7 +19630,7 @@ 1 2 - 329600 + 329601 2 @@ -20429,15 +20417,15 @@ derivedtypes - 3188501 + 3188505 id - 3188501 + 3188505 name - 1506660 + 1506662 kind @@ -20445,7 +20433,7 @@ type_id - 2055210 + 2055212 @@ -20459,7 +20447,7 @@ 1 2 - 3188501 + 3188505 @@ -20475,7 +20463,7 @@ 1 2 - 3188501 + 3188505 @@ -20491,7 +20479,7 @@ 1 2 - 3188501 + 3188505 @@ -20507,7 +20495,7 @@ 1 2 - 1369018 + 1369020 2 @@ -20533,7 +20521,7 @@ 1 2 - 1506660 + 1506662 @@ -20549,7 +20537,7 @@ 1 2 - 1369153 + 1369154 2 @@ -20698,7 +20686,7 @@ 1 2 - 1388259 + 1388260 2 @@ -20729,7 +20717,7 @@ 1 2 - 1389873 + 1389874 2 @@ -20760,7 +20748,7 @@ 1 2 - 1390142 + 1390144 2 @@ -20785,11 +20773,11 @@ pointerishsize - 2366956 + 2366958 id - 2366956 + 2366958 size @@ -20811,7 +20799,7 @@ 1 2 - 2366956 + 2366958 @@ -20827,7 +20815,7 @@ 1 2 - 2366956 + 2366958 @@ -21307,15 +21295,15 @@ typedefbase - 2175707 + 2175709 id - 2175707 + 2175709 type_id - 905391 + 905392 @@ -21329,7 +21317,7 @@ 1 2 - 2175707 + 2175709 @@ -21345,7 +21333,7 @@ 1 2 - 730534 + 730535 2 @@ -21370,19 +21358,19 @@ decltypes - 175604 + 175625 id - 15357 + 15417 expr - 161625 + 161560 base_type - 11272 + 11309 parentheses_would_change_meaning @@ -21400,37 +21388,37 @@ 1 2 - 2137 + 2185 2 3 - 6651 + 6656 3 4 - 2162 + 2161 4 5 - 1048 + 1055 5 9 - 1204 + 1212 9 - 21 - 1155 + 22 + 1204 - 21 + 22 1808 - 998 + 940 @@ -21446,7 +21434,7 @@ 1 2 - 15357 + 15417 @@ -21462,7 +21450,7 @@ 1 2 - 15357 + 15417 @@ -21478,16 +21466,16 @@ 1 2 - 148125 + 148024 2 3 - 13021 + 13057 3 - 4 + 5 478 @@ -21504,16 +21492,16 @@ 1 2 - 148125 + 148024 2 3 - 13021 + 13057 3 - 4 + 5 478 @@ -21530,7 +21518,7 @@ 1 2 - 161625 + 161560 @@ -21546,12 +21534,12 @@ 1 2 - 9786 + 9799 2 3 - 1312 + 1336 3 @@ -21572,12 +21560,12 @@ 1 2 - 965 + 981 2 3 - 5512 + 5518 3 @@ -21587,7 +21575,7 @@ 4 5 - 1097 + 1113 5 @@ -21597,7 +21585,7 @@ 8 41 - 858 + 857 42 @@ -21618,7 +21606,7 @@ 1 2 - 11272 + 11309 @@ -21637,8 +21625,8 @@ 8 - 1859 - 1860 + 1867 + 1868 8 @@ -21679,8 +21667,8 @@ 8 - 1364 - 1365 + 1369 + 1370 8 @@ -21691,19 +21679,19 @@ usertypes - 4993578 + 4992114 id - 4993578 + 4992114 name - 1075230 + 1074914 kind - 149 + 176 @@ -21717,7 +21705,7 @@ 1 2 - 4993578 + 4992114 @@ -21733,7 +21721,7 @@ 1 2 - 4993578 + 4992114 @@ -21749,22 +21737,22 @@ 1 2 - 743149 + 742931 2 3 - 197302 + 197244 3 7 - 86130 + 86104 7 29574 - 48648 + 48633 @@ -21780,12 +21768,12 @@ 1 2 - 1007380 + 1007057 2 - 9 - 67849 + 11 + 67856 @@ -21798,6 +21786,11 @@ 12 + + 28 + 29 + 13 + 64 65 @@ -21818,19 +21811,24 @@ 1477 13 + + 1874 + 1875 + 13 + 4522 4523 13 - 20080 - 20081 + 19666 + 19667 13 - 21568 - 21569 + 20080 + 20081 13 @@ -21864,6 +21862,11 @@ 12 + + 19 + 20 + 13 + 47 48 @@ -21894,6 +21897,11 @@ 1288 13 + + 1565 + 1566 + 13 + 3087 3088 @@ -21910,8 +21918,8 @@ 13 - 12472 - 12473 + 10903 + 10904 13 @@ -21927,15 +21935,15 @@ usertypesize - 1632392 + 1631913 id - 1632392 + 1631913 size - 1897 + 1896 alignment @@ -21953,7 +21961,7 @@ 1 2 - 1632392 + 1631913 @@ -21969,7 +21977,7 @@ 1 2 - 1632392 + 1631913 @@ -22046,7 +22054,7 @@ 1 2 - 1558 + 1557 2 @@ -22227,11 +22235,11 @@ nontype_template_parameters - 966312 + 966313 id - 966312 + 966313 @@ -22311,15 +22319,15 @@ mangled_name - 7783103 + 7780847 id - 7783103 + 7780847 mangled_name - 5327949 + 5325709 is_complete @@ -22337,7 +22345,7 @@ 1 2 - 7783103 + 7780847 @@ -22353,7 +22361,7 @@ 1 2 - 7783103 + 7780847 @@ -22369,17 +22377,17 @@ 1 2 - 4733697 + 4731591 2 3 - 459662 + 459555 3 8985 - 134588 + 134562 @@ -22395,7 +22403,7 @@ 1 2 - 5327949 + 5325709 @@ -22409,13 +22417,13 @@ 12 - 4956 - 4957 + 5006 + 5007 13 - 571027 - 571028 + 570979 + 570980 13 @@ -22435,8 +22443,8 @@ 13 - 391660 - 391661 + 391610 + 391611 13 @@ -22447,59 +22455,59 @@ is_pod_class - 747547 + 747548 id - 747547 + 747548 is_standard_layout_class - 1345030 + 1344635 id - 1345030 + 1344635 is_complete - 1611523 + 1611051 id - 1611523 + 1611051 is_class_template - 292267 + 292181 id - 292267 + 292181 class_instantiation - 1327901 + 1327512 to - 1323999 + 1323610 from - 91740 + 91713 @@ -22513,12 +22521,12 @@ 1 2 - 1321261 + 1320874 2 8 - 2737 + 2736 @@ -22534,47 +22542,47 @@ 1 2 - 26749 + 26741 2 3 - 16681 + 16676 3 4 - 9133 + 9130 4 5 - 5989 + 5987 5 7 - 7683 + 7681 7 10 - 6911 + 6908 10 17 - 7412 + 7410 17 53 - 6938 + 6936 53 4219 - 4241 + 4240 @@ -22584,11 +22592,11 @@ class_template_argument - 3503905 + 3502877 type_id - 1632270 + 1631791 index @@ -22596,7 +22604,7 @@ arg_type - 1034956 + 1034652 @@ -22610,27 +22618,27 @@ 1 2 - 679337 + 679138 2 3 - 490437 + 490293 3 4 - 308935 + 308844 4 7 - 124181 + 124144 7 113 - 29378 + 29369 @@ -22646,22 +22654,22 @@ 1 2 - 713906 + 713697 2 3 - 505790 + 505642 3 4 - 306997 + 306907 4 113 - 105575 + 105544 @@ -22682,7 +22690,7 @@ 4 5 - 962 + 961 5 @@ -22728,7 +22736,7 @@ 4 5 - 962 + 961 5 @@ -22769,27 +22777,27 @@ 1 2 - 649024 + 648834 2 3 - 212479 + 212417 3 4 - 62212 + 62194 4 11 - 78853 + 78830 11 11558 - 32386 + 32377 @@ -22805,17 +22813,17 @@ 1 2 - 912807 + 912540 2 3 - 98908 + 98879 3 22 - 23239 + 23233 @@ -22825,7 +22833,7 @@ class_template_argument_value - 643234 + 643235 type_id @@ -22837,7 +22845,7 @@ arg_value - 643062 + 643063 @@ -23020,7 +23028,7 @@ 1 2 - 642890 + 642891 2 @@ -23041,7 +23049,7 @@ 1 2 - 643062 + 643063 @@ -23051,15 +23059,15 @@ is_proxy_class_for - 61277 + 61259 id - 61277 + 61259 templ_param_id - 60152 + 60135 @@ -23073,7 +23081,7 @@ 1 2 - 61277 + 61259 @@ -23089,7 +23097,12 @@ 1 2 - 60152 + 59620 + + + 2 + 21 + 514 @@ -23099,11 +23112,11 @@ type_mentions - 5507859 + 5507864 id - 5507859 + 5507864 type_id @@ -23111,7 +23124,7 @@ location - 5462037 + 5462042 kind @@ -23129,7 +23142,7 @@ 1 2 - 5507859 + 5507864 @@ -23145,7 +23158,7 @@ 1 2 - 5507859 + 5507864 @@ -23161,7 +23174,7 @@ 1 2 - 5507859 + 5507864 @@ -23212,7 +23225,7 @@ 27 8555 - 19715 + 19716 @@ -23263,7 +23276,7 @@ 27 8555 - 19715 + 19716 @@ -23295,7 +23308,7 @@ 1 2 - 5416215 + 5416220 2 @@ -23316,7 +23329,7 @@ 1 2 - 5416215 + 5416220 2 @@ -23337,7 +23350,7 @@ 1 2 - 5462037 + 5462042 @@ -23395,22 +23408,22 @@ is_function_template - 1418397 + 1418399 id - 1418397 + 1418399 function_instantiation - 1226966 + 1226967 to - 1226966 + 1226967 from @@ -23428,7 +23441,7 @@ 1 2 - 1226966 + 1226967 @@ -23474,11 +23487,11 @@ function_template_argument - 3133427 + 3133430 function_id - 1832651 + 1832653 index @@ -23500,7 +23513,7 @@ 1 2 - 987407 + 987408 2 @@ -23510,7 +23523,7 @@ 3 4 - 216659 + 216660 4 @@ -23531,7 +23544,7 @@ 1 2 - 1011552 + 1011553 2 @@ -23694,7 +23707,7 @@ 3 4 - 25218 + 25219 4 @@ -23750,7 +23763,7 @@ function_template_argument_value - 570971 + 570972 function_id @@ -23762,7 +23775,7 @@ arg_value - 567577 + 567578 @@ -23802,7 +23815,7 @@ 1 2 - 182203 + 182204 2 @@ -23955,7 +23968,7 @@ 1 2 - 564183 + 564184 2 @@ -23976,7 +23989,7 @@ 1 2 - 567577 + 567578 @@ -24080,11 +24093,11 @@ variable_template_argument - 525810 + 525811 variable_id - 267210 + 267211 index @@ -24092,7 +24105,7 @@ arg_type - 257119 + 257120 @@ -24137,12 +24150,12 @@ 1 2 - 122168 + 122169 2 3 - 99295 + 99296 3 @@ -24497,15 +24510,15 @@ template_template_instantiation - 7439 + 7437 to - 6978 + 6976 from - 4932 + 4931 @@ -24519,7 +24532,7 @@ 1 2 - 6829 + 6827 2 @@ -24540,12 +24553,12 @@ 1 2 - 3225 + 3224 2 3 - 1531 + 1530 3 @@ -24560,11 +24573,11 @@ template_template_argument - 12412 + 12409 type_id - 7846 + 7843 index @@ -24572,7 +24585,7 @@ arg_type - 11653 + 11650 @@ -24586,12 +24599,12 @@ 1 2 - 6436 + 6434 2 3 - 542 + 541 3 @@ -24617,12 +24630,12 @@ 1 2 - 6463 + 6461 2 4 - 718 + 717 4 @@ -24770,7 +24783,7 @@ 1 2 - 11613 + 11609 3 @@ -24791,7 +24804,7 @@ 1 2 - 11626 + 11623 2 @@ -25398,7 +25411,7 @@ 1 2 - 19325 + 19326 2 @@ -25460,7 +25473,7 @@ 1 2 - 66 + 65 2 @@ -25549,11 +25562,11 @@ routinetypes - 762068 + 762069 id - 762068 + 762069 return_type @@ -25571,7 +25584,7 @@ 1 2 - 762068 + 762069 @@ -25597,7 +25610,7 @@ 3 4676 - 18344 + 18345 @@ -25607,7 +25620,7 @@ routinetypeargs - 1165646 + 1165647 routine @@ -25648,7 +25661,7 @@ 4 5 - 48934 + 48935 5 @@ -25917,12 +25930,12 @@ 6 8 - 9502 + 9503 8 13 - 9502 + 9503 13 @@ -25948,7 +25961,7 @@ 1 2 - 78153 + 78154 2 @@ -25958,7 +25971,7 @@ 3 5 - 9502 + 9503 5 @@ -25973,19 +25986,19 @@ ptrtomembers - 12087 + 12083 id - 12087 + 12083 type_id - 10163 + 10160 class_id - 5989 + 5987 @@ -25999,7 +26012,7 @@ 1 2 - 12087 + 12083 @@ -26015,7 +26028,7 @@ 1 2 - 12087 + 12083 @@ -26031,7 +26044,7 @@ 1 2 - 9878 + 9875 2 @@ -26052,7 +26065,7 @@ 1 2 - 9878 + 9875 2 @@ -26073,12 +26086,12 @@ 1 2 - 4878 + 4876 2 3 - 542 + 541 8 @@ -26104,12 +26117,12 @@ 1 2 - 4878 + 4876 2 3 - 542 + 541 8 @@ -26177,11 +26190,11 @@ typespecifiers - 988381 + 988078 type_id - 981795 + 981494 spec_id @@ -26199,12 +26212,12 @@ 1 2 - 975210 + 974910 2 3 - 6585 + 6583 @@ -26253,8 +26266,8 @@ 13 - 48324 - 48325 + 48323 + 48324 13 @@ -26265,11 +26278,11 @@ funspecifiers - 9758632 + 9758684 func_id - 3343814 + 3343817 spec_id @@ -26292,22 +26305,22 @@ 2 3 - 686368 + 686369 3 4 - 1416774 + 1416775 4 5 - 458152 + 458109 5 6 - 233887 + 233931 6 @@ -26406,8 +26419,8 @@ 42 - 42406 - 42407 + 42407 + 42408 42 @@ -26428,11 +26441,11 @@ varspecifiers - 2898031 + 2898033 var_id - 2545000 + 2545002 spec_id @@ -26450,12 +26463,12 @@ 1 2 - 2191969 + 2191971 2 3 - 353030 + 353031 @@ -26559,11 +26572,11 @@ attributes - 629815 + 629816 id - 629815 + 629816 kind @@ -26579,7 +26592,7 @@ location - 623357 + 623358 @@ -26593,7 +26606,7 @@ 1 2 - 629815 + 629816 @@ -26609,7 +26622,7 @@ 1 2 - 629815 + 629816 @@ -26625,7 +26638,7 @@ 1 2 - 629815 + 629816 @@ -26641,7 +26654,7 @@ 1 2 - 629815 + 629816 @@ -27029,7 +27042,7 @@ 1 2 - 617033 + 617034 2 @@ -27050,7 +27063,7 @@ 1 2 - 623357 + 623358 @@ -27087,7 +27100,7 @@ 1 2 - 623357 + 623358 @@ -27097,11 +27110,11 @@ attribute_args - 99111 + 99055 id - 99111 + 99055 kind @@ -27109,7 +27122,7 @@ attribute - 85357 + 85332 index @@ -27117,7 +27130,7 @@ location - 91970 + 91943 @@ -27131,7 +27144,7 @@ 1 2 - 99111 + 99055 @@ -27147,7 +27160,7 @@ 1 2 - 99111 + 99055 @@ -27163,7 +27176,7 @@ 1 2 - 99111 + 99055 @@ -27179,7 +27192,7 @@ 1 2 - 99111 + 99055 @@ -27208,8 +27221,8 @@ 13 - 6611 - 6612 + 6609 + 6610 13 @@ -27314,17 +27327,17 @@ 1 2 - 77240 + 77245 2 4 - 6761 + 6732 4 18 - 1355 + 1354 @@ -27340,12 +27353,12 @@ 1 2 - 83053 + 83029 2 3 - 2303 + 2302 @@ -27361,12 +27374,12 @@ 1 2 - 79069 + 79046 2 6 - 6287 + 6285 @@ -27382,12 +27395,12 @@ 1 2 - 80682 + 80658 2 6 - 4675 + 4673 @@ -27421,8 +27434,8 @@ 13 - 6494 - 6495 + 6492 + 6493 13 @@ -27537,12 +27550,12 @@ 1 2 - 89395 + 89396 2 23 - 2574 + 2546 @@ -27558,7 +27571,7 @@ 1 2 - 91753 + 91726 2 @@ -27579,7 +27592,7 @@ 1 2 - 91564 + 91537 2 @@ -27600,7 +27613,7 @@ 1 2 - 91414 + 91388 2 @@ -27771,15 +27784,15 @@ attribute_arg_constant - 89585 + 89532 arg - 89585 + 89532 constant - 89585 + 89532 @@ -27793,7 +27806,7 @@ 1 2 - 89585 + 89532 @@ -27809,7 +27822,7 @@ 1 2 - 89585 + 89532 @@ -27819,15 +27832,15 @@ attribute_arg_expr - 1802 + 1801 arg - 1802 + 1801 expr - 1802 + 1801 @@ -27841,7 +27854,7 @@ 1 2 - 1802 + 1801 @@ -27857,7 +27870,7 @@ 1 2 - 1802 + 1801 @@ -27988,15 +28001,15 @@ funcattributes - 824909 + 824910 func_id - 776472 + 776473 spec_id - 598600 + 598601 @@ -28031,7 +28044,7 @@ 1 2 - 555007 + 555008 2 @@ -28177,15 +28190,15 @@ unspecifiedtype - 8352759 + 8350268 type_id - 8352759 + 8350268 unspecified_type_id - 4805125 + 4803702 @@ -28199,7 +28212,7 @@ 1 2 - 8352759 + 8350268 @@ -28215,17 +28228,17 @@ 1 2 - 3204062 + 3203136 2 3 - 1309418 + 1309006 3 6271 - 291644 + 291558 @@ -28235,7 +28248,7 @@ member - 4687080 + 4687213 parent @@ -28247,7 +28260,7 @@ child - 4569878 + 4570011 @@ -28337,7 +28350,7 @@ 4 5 - 37849 + 37850 5 @@ -28416,7 +28429,7 @@ 816 - 222 + 223 328 816 @@ -28520,7 +28533,7 @@ 1 2 - 4569878 + 4570011 @@ -28536,7 +28549,7 @@ 1 2 - 4482020 + 4482153 2 @@ -28614,11 +28627,11 @@ derivations - 599885 + 599886 derivation - 599885 + 599886 sub @@ -28648,7 +28661,7 @@ 1 2 - 599885 + 599886 @@ -28664,7 +28677,7 @@ 1 2 - 599885 + 599886 @@ -28680,7 +28693,7 @@ 1 2 - 599885 + 599886 @@ -28696,7 +28709,7 @@ 1 2 - 599885 + 599886 @@ -28712,7 +28725,7 @@ 1 2 - 551638 + 551639 2 @@ -28733,7 +28746,7 @@ 1 2 - 551638 + 551639 2 @@ -28754,7 +28767,7 @@ 1 2 - 551638 + 551639 2 @@ -28775,7 +28788,7 @@ 1 2 - 551638 + 551639 2 @@ -29132,11 +29145,11 @@ derspecifiers - 602119 + 602120 der_id - 599326 + 599327 spec_id @@ -29630,7 +29643,7 @@ 1 2 - 60748 + 60749 2 @@ -29671,7 +29684,7 @@ 1 2 - 60748 + 60749 2 @@ -29790,19 +29803,19 @@ comments - 11290133 + 11290144 id - 11290133 + 11290144 contents - 4299055 + 4299059 location - 11290133 + 11290144 @@ -29816,7 +29829,7 @@ 1 2 - 11290133 + 11290144 @@ -29832,7 +29845,7 @@ 1 2 - 11290133 + 11290144 @@ -29848,7 +29861,7 @@ 1 2 - 3932683 + 3932686 2 @@ -29874,7 +29887,7 @@ 1 2 - 3932683 + 3932686 2 @@ -29900,7 +29913,7 @@ 1 2 - 11290133 + 11290144 @@ -29916,7 +29929,7 @@ 1 2 - 11290133 + 11290144 @@ -29926,15 +29939,15 @@ commentbinding - 3315380 + 3315383 id - 3261830 + 3261833 element - 3172356 + 3172359 @@ -29948,7 +29961,7 @@ 1 2 - 3230077 + 3230080 2 @@ -29969,7 +29982,7 @@ 1 2 - 3029332 + 3029335 2 @@ -29984,15 +29997,15 @@ exprconv - 9603737 + 9603746 converted - 9603632 + 9603641 conversion - 9603737 + 9603746 @@ -30006,7 +30019,7 @@ 1 2 - 9603527 + 9603536 2 @@ -30027,7 +30040,7 @@ 1 2 - 9603737 + 9603746 @@ -30037,22 +30050,22 @@ compgenerated - 10714761 + 10714601 id - 10714761 + 10714601 synthetic_destructor_call - 1791782 + 1791784 element - 1334393 + 1334394 i @@ -30060,7 +30073,7 @@ destructor_call - 1791782 + 1791784 @@ -30074,12 +30087,12 @@ 1 2 - 888211 + 888212 2 3 - 438893 + 438894 3 @@ -30100,12 +30113,12 @@ 1 2 - 888211 + 888212 2 3 - 438893 + 438894 3 @@ -30258,7 +30271,7 @@ 1 2 - 1791782 + 1791784 @@ -30274,7 +30287,7 @@ 1 2 - 1791782 + 1791784 @@ -30284,15 +30297,15 @@ namespaces - 11098 + 11095 id - 11098 + 11095 name - 5867 + 5865 @@ -30306,7 +30319,7 @@ 1 2 - 11098 + 11095 @@ -30322,7 +30335,7 @@ 1 2 - 4797 + 4795 2 @@ -30353,15 +30366,15 @@ namespacembrs - 2026753 + 2026145 parentid - 10366 + 10363 memberid - 2026753 + 2026145 @@ -30380,7 +30393,7 @@ 2 3 - 989 + 988 3 @@ -30415,7 +30428,7 @@ 36 55 - 813 + 812 56 @@ -30451,7 +30464,7 @@ 1 2 - 2026753 + 2026145 @@ -30461,11 +30474,11 @@ exprparents - 19401280 + 19401299 expr_id - 19401280 + 19401299 child_index @@ -30473,7 +30486,7 @@ parent_id - 12904777 + 12904789 @@ -30487,7 +30500,7 @@ 1 2 - 19401280 + 19401299 @@ -30503,7 +30516,7 @@ 1 2 - 19401280 + 19401299 @@ -30621,17 +30634,17 @@ 1 2 - 7374635 + 7374642 2 3 - 5068850 + 5068854 3 712 - 461291 + 461292 @@ -30647,17 +30660,17 @@ 1 2 - 7374635 + 7374642 2 3 - 5068850 + 5068854 3 712 - 461291 + 461292 @@ -30667,22 +30680,22 @@ expr_isload - 6961477 + 6961484 expr_id - 6961477 + 6961484 conversionkinds - 6048224 + 6048225 expr_id - 6048224 + 6048225 kind @@ -30700,7 +30713,7 @@ 1 2 - 6048224 + 6048225 @@ -30744,8 +30757,8 @@ 1 - 5829769 - 5829770 + 5829770 + 5829771 1 @@ -30756,11 +30769,11 @@ iscall - 6219950 + 6219955 caller - 6219950 + 6219955 kind @@ -30778,7 +30791,7 @@ 1 2 - 6219950 + 6219955 @@ -30814,11 +30827,11 @@ numtemplatearguments - 723402 + 723403 expr_id - 723402 + 723403 num @@ -30836,7 +30849,7 @@ 1 2 - 723402 + 723403 @@ -30945,15 +30958,15 @@ namequalifiers - 3258067 + 3258071 id - 3258067 + 3258071 qualifiableelement - 3258067 + 3258071 qualifyingelement @@ -30975,7 +30988,7 @@ 1 2 - 3258067 + 3258071 @@ -30991,7 +31004,7 @@ 1 2 - 3258067 + 3258071 @@ -31007,7 +31020,7 @@ 1 2 - 3258067 + 3258071 @@ -31023,7 +31036,7 @@ 1 2 - 3258067 + 3258071 @@ -31039,7 +31052,7 @@ 1 2 - 3258067 + 3258071 @@ -31055,7 +31068,7 @@ 1 2 - 3258067 + 3258071 @@ -31184,7 +31197,7 @@ 6 7 - 427777 + 427778 7 @@ -31215,7 +31228,7 @@ 6 7 - 427777 + 427778 7 @@ -31246,7 +31259,7 @@ 4 5 - 445212 + 445213 5 @@ -31261,15 +31274,15 @@ varbind - 8226108 + 8226116 expr - 8226108 + 8226116 var - 1047518 + 1047519 @@ -31283,7 +31296,7 @@ 1 2 - 8226108 + 8226116 @@ -31354,11 +31367,11 @@ funbind - 6230374 + 6230380 expr - 6227721 + 6227727 fun @@ -31376,7 +31389,7 @@ 1 2 - 6225069 + 6225075 2 @@ -31397,7 +31410,7 @@ 1 2 - 194320 + 194321 2 @@ -31700,15 +31713,15 @@ expr_cond_guard - 896444 + 896445 cond - 896444 + 896445 guard - 896444 + 896445 @@ -31722,7 +31735,7 @@ 1 2 - 896444 + 896445 @@ -31738,7 +31751,7 @@ 1 2 - 896444 + 896445 @@ -31748,15 +31761,15 @@ expr_cond_true - 896441 + 896442 cond - 896441 + 896442 true - 896441 + 896442 @@ -31770,7 +31783,7 @@ 1 2 - 896441 + 896442 @@ -31786,7 +31799,7 @@ 1 2 - 896441 + 896442 @@ -31796,15 +31809,15 @@ expr_cond_false - 896444 + 896445 cond - 896444 + 896445 false - 896444 + 896445 @@ -31818,7 +31831,7 @@ 1 2 - 896444 + 896445 @@ -31834,7 +31847,7 @@ 1 2 - 896444 + 896445 @@ -31844,11 +31857,11 @@ values - 14099251 + 14099264 id - 14099251 + 14099264 str @@ -31866,7 +31879,7 @@ 1 2 - 14099251 + 14099264 @@ -31912,11 +31925,11 @@ valuetext - 6605852 + 6605761 id - 6605852 + 6605761 text @@ -31934,7 +31947,7 @@ 1 2 - 6605852 + 6605761 @@ -31975,15 +31988,15 @@ valuebind - 14484486 + 14484500 val - 14099251 + 14099264 expr - 14484486 + 14484500 @@ -31997,7 +32010,7 @@ 1 2 - 13735581 + 13735595 2 @@ -32018,7 +32031,7 @@ 1 2 - 14484486 + 14484500 @@ -32028,11 +32041,11 @@ fieldoffsets - 1441779 + 1441780 id - 1441779 + 1441780 byteoffset @@ -32054,7 +32067,7 @@ 1 2 - 1441779 + 1441780 @@ -32070,7 +32083,7 @@ 1 2 - 1441779 + 1441780 @@ -32455,23 +32468,23 @@ initialisers - 2336670 + 2336672 init - 2336670 + 2336672 var - 983090 + 983091 expr - 2336670 + 2336672 location - 539034 + 539035 @@ -32485,7 +32498,7 @@ 1 2 - 2336670 + 2336672 @@ -32501,7 +32514,7 @@ 1 2 - 2336670 + 2336672 @@ -32517,7 +32530,7 @@ 1 2 - 2336670 + 2336672 @@ -32533,7 +32546,7 @@ 1 2 - 865933 + 865934 2 @@ -32559,7 +32572,7 @@ 1 2 - 865933 + 865934 2 @@ -32585,7 +32598,7 @@ 1 2 - 983081 + 983082 2 @@ -32606,7 +32619,7 @@ 1 2 - 2336670 + 2336672 @@ -32622,7 +32635,7 @@ 1 2 - 2336670 + 2336672 @@ -32638,7 +32651,7 @@ 1 2 - 2336670 + 2336672 @@ -32685,7 +32698,7 @@ 1 2 - 470681 + 470682 2 @@ -32736,26 +32749,26 @@ braced_initialisers - 74301 + 74272 init - 74301 + 74272 expr_ancestor - 1798194 + 1798195 exp - 1798194 + 1798195 ancestor - 899973 + 899974 @@ -32769,7 +32782,7 @@ 1 2 - 1798194 + 1798195 @@ -32805,11 +32818,11 @@ exprs - 25135858 + 25135882 id - 25135858 + 25135882 kind @@ -32817,7 +32830,7 @@ location - 11535471 + 11535482 @@ -32831,7 +32844,7 @@ 1 2 - 25135858 + 25135882 @@ -32847,7 +32860,7 @@ 1 2 - 25135858 + 25135882 @@ -33025,17 +33038,17 @@ 1 2 - 9705662 + 9705672 2 3 - 898509 + 898510 3 16 - 866990 + 866991 16 @@ -33056,17 +33069,17 @@ 1 2 - 9853405 + 9853414 2 3 - 844292 + 844293 3 32 - 837773 + 837774 @@ -33076,15 +33089,15 @@ expr_reuse - 907883 + 907884 reuse - 907883 + 907884 original - 907883 + 907884 value_category @@ -33102,7 +33115,7 @@ 1 2 - 907883 + 907884 @@ -33118,7 +33131,7 @@ 1 2 - 907883 + 907884 @@ -33134,7 +33147,7 @@ 1 2 - 907883 + 907884 @@ -33150,7 +33163,7 @@ 1 2 - 907883 + 907884 @@ -33202,11 +33215,11 @@ expr_types - 25135858 + 25135882 id - 25135858 + 25135882 typeid @@ -33228,7 +33241,7 @@ 1 2 - 25135858 + 25135882 @@ -33244,7 +33257,7 @@ 1 2 - 25135858 + 25135882 @@ -34623,11 +34636,11 @@ uuidof_bind - 27727 + 27728 expr - 27727 + 27728 type_id @@ -34645,7 +34658,7 @@ 1 2 - 27727 + 27728 @@ -34676,11 +34689,11 @@ sizeof_bind - 245234 + 245235 expr - 245234 + 245235 type_id @@ -34698,7 +34711,7 @@ 1 2 - 245234 + 245235 @@ -36282,11 +36295,11 @@ stmts - 6324261 + 6324267 id - 6324261 + 6324267 kind @@ -36294,7 +36307,7 @@ location - 2966229 + 2966232 @@ -36308,7 +36321,7 @@ 1 2 - 6324261 + 6324267 @@ -36324,7 +36337,7 @@ 1 2 - 6324261 + 6324267 @@ -36552,7 +36565,7 @@ 1 2 - 2357134 + 2357136 2 @@ -36562,7 +36575,7 @@ 3 8 - 228595 + 228596 8 @@ -36583,7 +36596,7 @@ 1 2 - 2892632 + 2892635 2 @@ -36742,15 +36755,15 @@ if_then - 987520 + 987521 if_stmt - 987520 + 987521 then_id - 987520 + 987521 @@ -36764,7 +36777,7 @@ 1 2 - 987520 + 987521 @@ -36780,7 +36793,7 @@ 1 2 - 987520 + 987521 @@ -36980,6 +36993,102 @@ + + consteval_if_then + 6 + + + constexpr_if_stmt + 6 + + + then_id + 6 + + + + + constexpr_if_stmt + then_id + + + 12 + + + 1 + 2 + 6 + + + + + + + then_id + constexpr_if_stmt + + + 12 + + + 1 + 2 + 6 + + + + + + + + + consteval_if_else + 2 + + + constexpr_if_stmt + 2 + + + else_id + 2 + + + + + constexpr_if_stmt + else_id + + + 12 + + + 1 + 2 + 2 + + + + + + + else_id + constexpr_if_stmt + + + 12 + + + 1 + 2 + 2 + + + + + + + while_body 39540 @@ -37126,11 +37235,11 @@ switch_case - 896214 + 896215 switch_stmt - 441453 + 441454 index @@ -37138,7 +37247,7 @@ case_id - 896214 + 896215 @@ -37346,7 +37455,7 @@ 1 2 - 896214 + 896215 @@ -37362,7 +37471,7 @@ 1 2 - 896214 + 896215 @@ -37372,15 +37481,15 @@ switch_body - 441453 + 441454 switch_stmt - 441453 + 441454 body_id - 441453 + 441454 @@ -37394,7 +37503,7 @@ 1 2 - 441453 + 441454 @@ -37410,7 +37519,7 @@ 1 2 - 441453 + 441454 @@ -37612,11 +37721,11 @@ stmtparents - 5536438 + 5536443 id - 5536438 + 5536443 index @@ -37624,7 +37733,7 @@ parent - 2349073 + 2349075 @@ -37638,7 +37747,7 @@ 1 2 - 5536438 + 5536443 @@ -37654,7 +37763,7 @@ 1 2 - 5536438 + 5536443 @@ -37792,12 +37901,12 @@ 1 2 - 1349052 + 1349054 2 3 - 508947 + 508948 3 @@ -37833,12 +37942,12 @@ 1 2 - 1349052 + 1349054 2 3 - 508947 + 508948 3 @@ -37868,22 +37977,22 @@ ishandler - 47466 + 47521 block - 47466 + 47521 stmt_decl_bind - 730759 + 730763 stmt - 690290 + 690293 num @@ -37891,7 +38000,7 @@ decl - 730690 + 730694 @@ -37905,7 +38014,7 @@ 1 2 - 668061 + 668064 2 @@ -37926,7 +38035,7 @@ 1 2 - 668061 + 668064 2 @@ -38069,7 +38178,7 @@ 1 2 - 730666 + 730669 2 @@ -38090,7 +38199,7 @@ 1 2 - 730690 + 730694 @@ -38100,11 +38209,11 @@ stmt_decl_entry_bind - 730759 + 730763 stmt - 690290 + 690293 num @@ -38112,7 +38221,7 @@ decl_entry - 730759 + 730763 @@ -38126,7 +38235,7 @@ 1 2 - 668061 + 668064 2 @@ -38147,7 +38256,7 @@ 1 2 - 668061 + 668064 2 @@ -38290,7 +38399,7 @@ 1 2 - 730759 + 730763 @@ -38306,7 +38415,7 @@ 1 2 - 730759 + 730763 @@ -38316,15 +38425,15 @@ blockscope - 1838723 + 1838725 block - 1838723 + 1838725 enclosing - 1575683 + 1575684 @@ -38338,7 +38447,7 @@ 1 2 - 1838723 + 1838725 @@ -38354,7 +38463,7 @@ 1 2 - 1400368 + 1400369 2 @@ -38364,7 +38473,7 @@ 3 28 - 45476 + 45477 @@ -38519,7 +38628,7 @@ 4 5 - 7358 + 7359 5 @@ -38555,11 +38664,11 @@ preprocdirects - 5704671 + 5704676 id - 5704671 + 5704676 kind @@ -38567,7 +38676,7 @@ location - 5701307 + 5701312 @@ -38581,7 +38690,7 @@ 1 2 - 5704671 + 5704676 @@ -38597,7 +38706,7 @@ 1 2 - 5704671 + 5704676 @@ -38745,7 +38854,7 @@ 1 2 - 5701172 + 5701178 26 @@ -38766,7 +38875,7 @@ 1 2 - 5701307 + 5701312 @@ -38776,15 +38885,15 @@ preprocpair - 1103826 + 1103827 begin - 846302 + 846303 elseelifend - 1103826 + 1103827 @@ -38798,7 +38907,7 @@ 1 2 - 601560 + 601561 2 @@ -38824,7 +38933,7 @@ 1 2 - 1103826 + 1103827 @@ -38856,19 +38965,19 @@ preproctext - 4599768 + 4599773 id - 4599768 + 4599773 head - 3333543 + 3333547 body - 1948244 + 1948246 @@ -38882,7 +38991,7 @@ 1 2 - 4599768 + 4599773 @@ -38898,7 +39007,7 @@ 1 2 - 4599768 + 4599773 @@ -38914,7 +39023,7 @@ 1 2 - 3143966 + 3143969 2 @@ -38935,7 +39044,7 @@ 1 2 - 3253353 + 3253356 2 @@ -38956,7 +39065,7 @@ 1 2 - 1763646 + 1763647 2 @@ -38982,7 +39091,7 @@ 1 2 - 1767547 + 1767549 2 @@ -39002,15 +39111,15 @@ includes - 408792 + 408672 id - 408792 + 408672 included - 75302 + 75280 @@ -39024,7 +39133,7 @@ 1 2 - 408792 + 408672 @@ -39040,32 +39149,32 @@ 1 2 - 37265 + 37254 2 3 - 12114 + 12111 3 4 - 6355 + 6353 4 6 - 6870 + 6868 6 11 - 5799 + 5798 11 47 - 5650 + 5649 47 @@ -39128,11 +39237,11 @@ link_parent - 38279677 + 38279714 element - 4869241 + 4869246 link_target @@ -39160,7 +39269,7 @@ 9 10 - 4166460 + 4166464 From 6ad342c567307d2134e910edc9af4919ee3baa5c Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 16 Jan 2025 10:22:54 +0100 Subject: [PATCH 5/8] C++: Add change note --- cpp/ql/lib/change-notes/2024-01-16-consteval-if.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 cpp/ql/lib/change-notes/2024-01-16-consteval-if.md diff --git a/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md new file mode 100644 index 000000000000..5538b592899d --- /dev/null +++ b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md @@ -0,0 +1,4 @@ +--- +category: feature +--- +* New classes `ConstevalIfStmt` and `NotConstEvalIfStmt` were introduced, which represent the C++23 `if consteval` and `if ! consteval` statements. From 378f0368af5a2e9968d78b92b748a9fbeda15881 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:43:00 +0100 Subject: [PATCH 6/8] Update cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql --- .../1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql index cb15f30808da..e2c13bd4342e 100644 --- a/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql +++ b/cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql @@ -13,5 +13,5 @@ predicate isConstevalIf(Stmt stmt) { from Stmt stmt, int kind, int kind_new, Location location where stmts(stmt, kind, location) and - if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statement in it + if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statements in it select stmt, kind_new, location From a74189f6facd52df1f34effc27fde90eee7c22ca Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:43:25 +0100 Subject: [PATCH 7/8] Update cpp/ql/lib/change-notes/2024-01-16-consteval-if.md Co-authored-by: Calum Grant <42069085+calumgrant@users.noreply.github.com> --- cpp/ql/lib/change-notes/2024-01-16-consteval-if.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md index 5538b592899d..181bec4baf4d 100644 --- a/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md +++ b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md @@ -1,4 +1,4 @@ --- category: feature --- -* New classes `ConstevalIfStmt` and `NotConstEvalIfStmt` were introduced, which represent the C++23 `if consteval` and `if ! consteval` statements. +* New classes `ConstevalIfStmt` and `NotConstevalIfStmt` were introduced, which represent the C++23 `if consteval` and `if ! consteval` statements. From a9e0f2086159f360f060e5c958c5bc292deea246 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Mon, 20 Jan 2025 11:20:11 +0100 Subject: [PATCH 8/8] C++: Simplify consteval if to be just a single class with an `isNot` predicate --- .../change-notes/2024-01-16-consteval-if.md | 2 +- cpp/ql/lib/semmle/code/cpp/PrintAST.qll | 4 +- .../code/cpp/controlflow/internal/CFG.qll | 4 +- .../raw/internal/TranslatedStmt.qll | 4 +- cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll | 68 ++++++++----------- .../library-tests/ir/ir/PrintAST.expected | 6 +- 6 files changed, 37 insertions(+), 51 deletions(-) diff --git a/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md index 181bec4baf4d..0b6c2faea959 100644 --- a/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md +++ b/cpp/ql/lib/change-notes/2024-01-16-consteval-if.md @@ -1,4 +1,4 @@ --- category: feature --- -* New classes `ConstevalIfStmt` and `NotConstevalIfStmt` were introduced, which represent the C++23 `if consteval` and `if ! consteval` statements. +* A new class `ConstevalIfStmt` was introduced, which represents the C++23 `if consteval` and `if ! consteval` statements. diff --git a/cpp/ql/lib/semmle/code/cpp/PrintAST.qll b/cpp/ql/lib/semmle/code/cpp/PrintAST.qll index 11244c756206..4c13125cdbbd 100644 --- a/cpp/ql/lib/semmle/code/cpp/PrintAST.qll +++ b/cpp/ql/lib/semmle/code/cpp/PrintAST.qll @@ -912,9 +912,9 @@ private predicate namedStmtChildPredicates(Locatable s, Element e, string pred) or s.(ConstexprIfStmt).getElse() = e and pred = "getElse()" or - s.(ConstevalOrNotConstevalIfStmt).getThen() = e and pred = "getThen()" + s.(ConstevalIfStmt).getThen() = e and pred = "getThen()" or - s.(ConstevalOrNotConstevalIfStmt).getElse() = e and pred = "getElse()" + s.(ConstevalIfStmt).getElse() = e and pred = "getElse()" or s.(Handler).getParameter() = e and pred = "getParameter()" or diff --git a/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll b/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll index 19b0d48fdfdb..05eafe28275f 100644 --- a/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll +++ b/cpp/ql/lib/semmle/code/cpp/controlflow/internal/CFG.qll @@ -876,8 +876,8 @@ private predicate subEdge(Pos p1, Node n1, Node n2, Pos p2) { p2.nodeAfter(n2, s) ) or - // ConstevalOrNotConstevalIfStmt -> { then, else } -> - exists(ConstevalOrNotConstevalIfStmt s | + // NotConstevalIfStmt -> { then, else } -> + exists(ConstevalIfStmt s | p1.nodeAt(n1, s) and p2.nodeBefore(n2, s.getThen()) or diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll index 41c1644c6183..3914c5e8e597 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll @@ -1098,8 +1098,8 @@ class TranslatedConstExprIfStmt extends TranslatedIfLikeStmt { override predicate hasElse() { exists(stmt.getElse()) } } -class TranslatedConstevalOrNotConstevalIfStmt extends TranslatedStmt { - override ConstevalOrNotConstevalIfStmt stmt; +class TranslatedConstevalIfStmt extends TranslatedStmt { + override ConstevalIfStmt stmt; override Instruction getFirstInstruction(EdgeKind kind) { if not this.hasEvaluatedBranch() diff --git a/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll b/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll index 8958811453c1..aa6a585ea4b3 100644 --- a/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/stmts/Stmt.qll @@ -446,7 +446,27 @@ class ConstexprIfStmt extends ConditionalStmt, @stmt_constexpr_if { * } * ``` */ -class ConstevalOrNotConstevalIfStmt extends Stmt, @stmt_consteval_or_not_consteval_if { +class ConstevalIfStmt extends Stmt, @stmt_consteval_or_not_consteval_if { + override string getAPrimaryQlClass() { result = "ConstevalIfStmt" } + + override string toString() { + if this.isNot() then result = "if ! consteval ..." else result = "if consteval ..." + } + + /** + * Holds if this is a 'not consteval if' statement. + * + * For example, this holds for + * ```cpp + * if ! consteval { return true; } + * ``` + * but not for + * ```cpp + * if consteval { return true; } + * ``` + */ + predicate isNot() { this instanceof @stmt_not_consteval_if } + /** * Gets the 'then' statement of this '(not) consteval if' statement. * @@ -515,7 +535,9 @@ class ConstevalOrNotConstevalIfStmt extends Stmt, @stmt_consteval_or_not_constev * ``` * there is no result. */ - Stmt getCompileTimeEvaluatedBranch() { none() } + Stmt getCompileTimeEvaluatedBranch() { + if this.isNot() then result = this.getElse() else result = this.getThen() + } /** * Holds if this '(not) constexpr if' statement has a compile time evaluated statement. @@ -544,7 +566,9 @@ class ConstevalOrNotConstevalIfStmt extends Stmt, @stmt_consteval_or_not_constev * ``` * there is no result. */ - Stmt getRuntimeEvaluatedBranch() { none() } + Stmt getRuntimeEvaluatedBranch() { + if this.isNot() then result = this.getThen() else result = this.getElse() + } /** * Holds if this '(not) constexpr if' statement has a runtime evaluated statement. @@ -561,44 +585,6 @@ class ConstevalOrNotConstevalIfStmt extends Stmt, @stmt_consteval_or_not_constev predicate hasRuntimeEvaluatedBranch() { exists(this.getRuntimeEvaluatedBranch()) } } -/** - * A C/C++ 'consteval if'. For example, the `if consteval` statement - * in the following code: - * ```cpp - * if consteval { - * ... - * } - * ``` - */ -class ConstevalIfStmt extends ConstevalOrNotConstevalIfStmt, @stmt_consteval_if { - override string getAPrimaryQlClass() { result = "ConstevalIfStmt" } - - override string toString() { result = "if consteval ..." } - - override Stmt getCompileTimeEvaluatedBranch() { result = this.getThen() } - - override Stmt getRuntimeEvaluatedBranch() { result = this.getElse() } -} - -/** - * A C/C++ 'not consteval if'. For example, the `if ! consteval` statement - * in the following code: - * ```cpp - * if ! consteval { - * ... - * } - * ``` - */ -class NotConstevalIfStmt extends ConstevalOrNotConstevalIfStmt, @stmt_not_consteval_if { - override string getAPrimaryQlClass() { result = "NotConstevalIfStmt" } - - override string toString() { result = "if ! consteval ..." } - - override Stmt getCompileTimeEvaluatedBranch() { result = this.getElse() } - - override Stmt getRuntimeEvaluatedBranch() { result = this.getThen() } -} - private class TLoop = @stmt_while or @stmt_end_test_while or @stmt_range_based_for or @stmt_for; /** diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 530bb5bb12f6..f99adc3208d6 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -24138,7 +24138,7 @@ ir23.cpp: # 10| [TopLevelFunction] bool consteval_2() # 10| : # 11| getEntryPoint(): [BlockStmt] { ... } -# 12| getStmt(0): [NotConstevalIfStmt] if ! consteval ... +# 12| getStmt(0): [ConstevalIfStmt] if ! consteval ... # 12| getThen(): [BlockStmt] { ... } # 13| getStmt(0): [ReturnStmt] return ... # 13| getExpr(): [Literal] 1 @@ -24169,7 +24169,7 @@ ir23.cpp: # 28| [TopLevelFunction] bool consteval_4() # 28| : # 29| getEntryPoint(): [BlockStmt] { ... } -# 30| getStmt(0): [NotConstevalIfStmt] if ! consteval ... +# 30| getStmt(0): [ConstevalIfStmt] if ! consteval ... # 30| getThen(): [BlockStmt] { ... } # 31| getStmt(0): [ReturnStmt] return ... # 31| getExpr(): [Literal] 1 @@ -24192,7 +24192,7 @@ ir23.cpp: # 39| Type = [BoolType] bool # 39| Value = [Literal] 1 # 39| ValueCategory = prvalue -# 41| getStmt(1): [NotConstevalIfStmt] if ! consteval ... +# 41| getStmt(1): [ConstevalIfStmt] if ! consteval ... # 41| getThen(): [BlockStmt] { ... } # 42| getStmt(0): [ExprStmt] ExprStmt # 42| getExpr(): [AssignExpr] ... = ...