Address comments

This commit is contained in:
Arthur Baars
2024-09-06 11:47:08 +02:00
parent 679d81ab00
commit ce2fdb3463
31 changed files with 440 additions and 359 deletions

View File

@@ -4,7 +4,8 @@
*/
import codeql.rust.elements.Array
import codeql.rust.elements.Async
import codeql.rust.elements.AstNode
import codeql.rust.elements.AsyncBlock
import codeql.rust.elements.Await
import codeql.rust.elements.Become
import codeql.rust.elements.BinaryOp
@@ -63,11 +64,11 @@ import codeql.rust.elements.Tuple
import codeql.rust.elements.TuplePat
import codeql.rust.elements.TupleStructPat
import codeql.rust.elements.TypeRef
import codeql.rust.elements.UnaryExpr
import codeql.rust.elements.UnaryOp
import codeql.rust.elements.Underscore
import codeql.rust.elements.UnknownFile
import codeql.rust.elements.UnknownLocation
import codeql.rust.elements.Unsafe
import codeql.rust.elements.UnsafeBlock
import codeql.rust.elements.WildPat
import codeql.rust.elements.Yeet
import codeql.rust.elements.Yield

View File

@@ -1,8 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `Async`.
* This module provides a hand-modifiable wrapper around the generated class `AstNode`.
*/
private import codeql.rust.generated.Async
private import codeql.rust.generated.AstNode
class Async extends Generated::Async { }
class AstNode extends Generated::AstNode { }

View File

@@ -1,8 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `UnaryExpr`.
* This module provides a hand-modifiable wrapper around the generated class `AsyncBlock`.
*/
private import codeql.rust.generated.UnaryExpr
private import codeql.rust.generated.AsyncBlock
class UnaryExpr extends Generated::UnaryExpr { }
class AsyncBlock extends Generated::AsyncBlock { }

View File

@@ -1,14 +1,14 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module defines the hook used internally to tweak the characteristic predicate of
* `Async` synthesized instances.
* `AsyncBlock` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.rust.generated.Raw
/**
* The characteristic predicate of `Async` synthesized instances.
* The characteristic predicate of `AsyncBlock` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructAsync(Raw::Async id) { any() }
predicate constructAsyncBlock(Raw::AsyncBlock id) { any() }

View File

@@ -1,8 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `Unsafe`.
* This module provides a hand-modifiable wrapper around the generated class `UnaryOp`.
*/
private import codeql.rust.generated.Unsafe
private import codeql.rust.generated.UnaryOp
class Unsafe extends Generated::Unsafe { }
class UnaryOp extends Generated::UnaryOp { }

View File

@@ -1,14 +1,14 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module defines the hook used internally to tweak the characteristic predicate of
* `Unsafe` synthesized instances.
* `UnaryOp` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.rust.generated.Raw
/**
* The characteristic predicate of `Unsafe` synthesized instances.
* The characteristic predicate of `UnaryOp` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructUnsafe(Raw::Unsafe id) { any() }
predicate constructUnaryOp(Raw::UnaryOp id) { any() }

View File

@@ -0,0 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `UnsafeBlock`.
*/
private import codeql.rust.generated.UnsafeBlock
class UnsafeBlock extends Generated::UnsafeBlock { }

View File

@@ -1,14 +1,14 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module defines the hook used internally to tweak the characteristic predicate of
* `UnaryExpr` synthesized instances.
* `UnsafeBlock` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.rust.generated.Raw
/**
* The characteristic predicate of `UnaryExpr` synthesized instances.
* The characteristic predicate of `UnsafeBlock` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructUnaryExpr(Raw::UnaryExpr id) { any() }
predicate constructUnsafeBlock(Raw::UnsafeBlock id) { any() }

View File

@@ -0,0 +1,21 @@
// generated by codegen
/**
* This module provides the generated definition of `AstNode`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
/**
* INTERNAL: This module contains the fully generated definition of `AstNode` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::AstNode` class directly.
* Use the subclass `AstNode`, where the following predicates are available.
*/
class AstNode extends Synth::TAstNode, Locatable { }
}

View File

@@ -1,23 +0,0 @@
// generated by codegen
/**
* This module provides the generated definition of `Async`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Block
/**
* INTERNAL: This module contains the fully generated definition of `Async` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::Async` class directly.
* Use the subclass `Async`, where the following predicates are available.
*/
class Async extends Synth::TAsync, Block {
override string getAPrimaryQlClass() { result = "Async" }
}
}

View File

@@ -0,0 +1,23 @@
// generated by codegen
/**
* This module provides the generated definition of `AsyncBlock`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Block
/**
* INTERNAL: This module contains the fully generated definition of `AsyncBlock` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::AsyncBlock` class directly.
* Use the subclass `AsyncBlock`, where the following predicates are available.
*/
class AsyncBlock extends Synth::TAsyncBlock, Block {
override string getAPrimaryQlClass() { result = "AsyncBlock" }
}
}

View File

@@ -6,7 +6,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
import codeql.rust.elements.AstNode
/**
* INTERNAL: This module contains the fully generated definition of `Declaration` and should not
@@ -17,5 +17,5 @@ module Generated {
* INTERNAL: Do not reference the `Generated::Declaration` class directly.
* Use the subclass `Declaration`, where the following predicates are available.
*/
class Declaration extends Synth::TDeclaration, Locatable { }
class Declaration extends Synth::TDeclaration, AstNode { }
}

View File

@@ -6,7 +6,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
import codeql.rust.elements.AstNode
/**
* INTERNAL: This module contains the fully generated definition of `Expr` and should not
@@ -17,5 +17,5 @@ module Generated {
* INTERNAL: Do not reference the `Generated::Expr` class directly.
* Use the subclass `Expr`, where the following predicates are available.
*/
class Expr extends Synth::TExpr, Locatable { }
class Expr extends Synth::TExpr, AstNode { }
}

View File

@@ -28,22 +28,22 @@ module Generated {
}
/**
* Gets the then branch of this if.
* Gets the then of this if.
*/
Expr getThenBranch() {
result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getThenBranch())
Expr getThen() {
result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getThen())
}
/**
* Gets the else branch of this if, if it exists.
* Gets the else of this if, if it exists.
*/
Expr getElseBranch() {
result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getElseBranch())
Expr getElse() {
result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getElse())
}
/**
* Holds if `getElseBranch()` exists.
* Holds if `getElse()` exists.
*/
final predicate hasElseBranch() { exists(this.getElseBranch()) }
final predicate hasElse() { exists(this.getElse()) }
}
}

View File

@@ -6,8 +6,8 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.AstNode
import codeql.rust.elements.Expr
import codeql.rust.elements.Locatable
import codeql.rust.elements.Pat
/**
@@ -19,7 +19,7 @@ module Generated {
* INTERNAL: Do not reference the `Generated::MatchArm` class directly.
* Use the subclass `MatchArm`, where the following predicates are available.
*/
class MatchArm extends Synth::TMatchArm, Locatable {
class MatchArm extends Synth::TMatchArm, AstNode {
override string getAPrimaryQlClass() { result = "MatchArm" }
/**

View File

@@ -49,6 +49,19 @@ private module Impl {
)
}
private Element getImmediateChildOfAstNode(AstNode e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfDbFile(DbFile e, int index, string partialPredicateCall) {
exists(int b, int bFile, int n |
b = 0 and
@@ -75,86 +88,6 @@ private module Impl {
)
}
private Element getImmediateChildOfDeclaration(
Declaration e, int index, string partialPredicateCall
) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfExpr(Expr e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfPat(Pat e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfTypeRef(TypeRef e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n |
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfUnknownFile(
UnknownFile e, int index, string partialPredicateCall
) {
@@ -185,6 +118,86 @@ private module Impl {
)
}
private Element getImmediateChildOfDeclaration(
Declaration e, int index, string partialPredicateCall
) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfExpr(Expr e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfPat(Pat e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfTypeRef(TypeRef e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfArray(Array e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n |
b = 0 and
@@ -808,7 +821,7 @@ private module Impl {
)
}
private Element getImmediateChildOfUnaryExpr(UnaryExpr e, int index, string partialPredicateCall) {
private Element getImmediateChildOfUnaryOp(UnaryOp e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
@@ -873,7 +886,7 @@ private module Impl {
)
}
private Element getImmediateChildOfAsync(Async e, int index, string partialPredicateCall) {
private Element getImmediateChildOfAsyncBlock(AsyncBlock e, int index, string partialPredicateCall) {
exists(int b, int bBlock, int n |
b = 0 and
bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and
@@ -886,7 +899,9 @@ private module Impl {
)
}
private Element getImmediateChildOfUnsafe(Unsafe e, int index, string partialPredicateCall) {
private Element getImmediateChildOfUnsafeBlock(
UnsafeBlock e, int index, string partialPredicateCall
) {
exists(int b, int bBlock, int n |
b = 0 and
bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and
@@ -909,14 +924,14 @@ private module Impl {
or
result = getImmediateChildOfDbLocation(e, index, partialAccessor)
or
result = getImmediateChildOfMatchArm(e, index, partialAccessor)
or
result = getImmediateChildOfTypeRef(e, index, partialAccessor)
or
result = getImmediateChildOfUnknownFile(e, index, partialAccessor)
or
result = getImmediateChildOfUnknownLocation(e, index, partialAccessor)
or
result = getImmediateChildOfMatchArm(e, index, partialAccessor)
or
result = getImmediateChildOfTypeRef(e, index, partialAccessor)
or
result = getImmediateChildOfArray(e, index, partialAccessor)
or
result = getImmediateChildOfAwait(e, index, partialAccessor)
@@ -1009,7 +1024,7 @@ private module Impl {
or
result = getImmediateChildOfTupleStructPat(e, index, partialAccessor)
or
result = getImmediateChildOfUnaryExpr(e, index, partialAccessor)
result = getImmediateChildOfUnaryOp(e, index, partialAccessor)
or
result = getImmediateChildOfUnderscore(e, index, partialAccessor)
or
@@ -1019,9 +1034,9 @@ private module Impl {
or
result = getImmediateChildOfYield(e, index, partialAccessor)
or
result = getImmediateChildOfAsync(e, index, partialAccessor)
result = getImmediateChildOfAsyncBlock(e, index, partialAccessor)
or
result = getImmediateChildOfUnsafe(e, index, partialAccessor)
result = getImmediateChildOfUnsafeBlock(e, index, partialAccessor)
}
}

View File

@@ -6,7 +6,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
import codeql.rust.elements.AstNode
/**
* INTERNAL: This module contains the fully generated definition of `Pat` and should not
@@ -17,5 +17,5 @@ module Generated {
* INTERNAL: Do not reference the `Generated::Pat` class directly.
* Use the subclass `Pat`, where the following predicates are available.
*/
class Pat extends Synth::TPat, Locatable { }
class Pat extends Synth::TPat, AstNode { }
}

View File

@@ -60,6 +60,11 @@ module Raw {
int getEndColumn() { locations(this, _, _, _, _, result) }
}
/**
* INTERNAL: Do not use.
*/
class AstNode extends @ast_node, Locatable { }
/**
* INTERNAL: Do not use.
*/
@@ -77,17 +82,17 @@ module Raw {
/**
* INTERNAL: Do not use.
*/
class Declaration extends @declaration, Locatable { }
class Declaration extends @declaration, AstNode { }
/**
* INTERNAL: Do not use.
*/
class Expr extends @expr, Locatable { }
class Expr extends @expr, AstNode { }
/**
* INTERNAL: Do not use.
*/
class MatchArm extends @match_arm, Locatable {
class MatchArm extends @match_arm, AstNode {
override string toString() { result = "MatchArm" }
/**
@@ -109,17 +114,17 @@ module Raw {
/**
* INTERNAL: Do not use.
*/
class Pat extends @pat, Locatable { }
class Pat extends @pat, AstNode { }
/**
* INTERNAL: Do not use.
*/
class Stmt extends @stmt, Locatable { }
class Stmt extends @stmt, AstNode { }
/**
* INTERNAL: Do not use.
*/
class TypeRef extends @type_ref, Locatable {
class TypeRef extends @type_ref, AstNode {
override string toString() { result = "TypeRef" }
}
@@ -419,14 +424,14 @@ module Raw {
Expr getCondition() { ifs(this, result, _) }
/**
* Gets the then branch of this if.
* Gets the then of this if.
*/
Expr getThenBranch() { ifs(this, _, result) }
Expr getThen() { ifs(this, _, result) }
/**
* Gets the else branch of this if, if it exists.
* Gets the else of this if, if it exists.
*/
Expr getElseBranch() { if_else_branches(this, result) }
Expr getElse() { if_elses(this, result) }
}
/**
@@ -803,18 +808,18 @@ module Raw {
/**
* INTERNAL: Do not use.
*/
class UnaryExpr extends @unary_expr, Expr {
override string toString() { result = "UnaryExpr" }
class UnaryOp extends @unary_op, Expr {
override string toString() { result = "UnaryOp" }
/**
* Gets the expression of this unary expression.
* Gets the expression of this unary op.
*/
Expr getExpr() { unary_exprs(this, result, _) }
Expr getExpr() { unary_ops(this, result, _) }
/**
* Gets the op of this unary expression.
* Gets the op of this unary op.
*/
string getOp() { unary_exprs(this, _, result) }
string getOp() { unary_ops(this, _, result) }
}
/**
@@ -858,14 +863,14 @@ module Raw {
/**
* INTERNAL: Do not use.
*/
class Async extends @async, Block {
override string toString() { result = "Async" }
class AsyncBlock extends @async_block, Block {
override string toString() { result = "AsyncBlock" }
}
/**
* INTERNAL: Do not use.
*/
class Unsafe extends @unsafe, Block {
override string toString() { result = "Unsafe" }
class UnsafeBlock extends @unsafe_block, Block {
override string toString() { result = "UnsafeBlock" }
}
}

View File

@@ -6,7 +6,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
import codeql.rust.elements.AstNode
/**
* INTERNAL: This module contains the fully generated definition of `Stmt` and should not
@@ -17,5 +17,5 @@ module Generated {
* INTERNAL: Do not reference the `Generated::Stmt` class directly.
* Use the subclass `Stmt`, where the following predicates are available.
*/
class Stmt extends Synth::TStmt, Locatable { }
class Stmt extends Synth::TStmt, AstNode { }
}

View File

@@ -22,7 +22,7 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
TAsync(Raw::Async id) { constructAsync(id) } or
TAsyncBlock(Raw::AsyncBlock id) { constructAsyncBlock(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -222,7 +222,7 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
TUnaryExpr(Raw::UnaryExpr id) { constructUnaryExpr(id) } or
TUnaryOp(Raw::UnaryOp id) { constructUnaryOp(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -238,7 +238,7 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
TUnsafe(Raw::Unsafe id) { constructUnsafe(id) } or
TUnsafeBlock(Raw::UnsafeBlock id) { constructUnsafeBlock(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -255,7 +255,12 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
class TBlock = TAsync or TUnsafe;
class TAstNode = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef;
/**
* INTERNAL: Do not use.
*/
class TBlock = TAsyncBlock or TUnsafeBlock;
/**
* INTERNAL: Do not use.
@@ -269,7 +274,7 @@ module Synth {
TArray or TAwait or TBecome or TBinaryOp or TBlock or TBox or TBreak or TCall or TCast or
TClosure or TConst or TContinue or TField or TIf or TIndex or TInlineAsm or TLet or
TLiteral or TLoop or TMatch or TMethodCall or TMissingExpr or TOffsetOf or TPath or
TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryExpr or TUnderscore or TYeet or
TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryOp or TUnderscore or TYeet or
TYield;
/**
@@ -280,7 +285,7 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
class TLocatable = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef;
class TLocatable = TAstNode;
/**
* INTERNAL: Do not use.
@@ -308,10 +313,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TAsync`, if possible.
* Converts a raw element to a synthesized `TAsyncBlock`, if possible.
*/
cached
TAsync convertAsyncFromRaw(Raw::Element e) { result = TAsync(e) }
TAsyncBlock convertAsyncBlockFromRaw(Raw::Element e) { result = TAsyncBlock(e) }
/**
* INTERNAL: Do not use.
@@ -658,10 +663,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TUnaryExpr`, if possible.
* Converts a raw element to a synthesized `TUnaryOp`, if possible.
*/
cached
TUnaryExpr convertUnaryExprFromRaw(Raw::Element e) { result = TUnaryExpr(e) }
TUnaryOp convertUnaryOpFromRaw(Raw::Element e) { result = TUnaryOp(e) }
/**
* INTERNAL: Do not use.
@@ -686,10 +691,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TUnsafe`, if possible.
* Converts a raw element to a synthesized `TUnsafeBlock`, if possible.
*/
cached
TUnsafe convertUnsafeFromRaw(Raw::Element e) { result = TUnsafe(e) }
TUnsafeBlock convertUnsafeBlockFromRaw(Raw::Element e) { result = TUnsafeBlock(e) }
/**
* INTERNAL: Do not use.
@@ -712,15 +717,34 @@ module Synth {
cached
TYield convertYieldFromRaw(Raw::Element e) { result = TYield(e) }
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TAstNode`, if possible.
*/
cached
TAstNode convertAstNodeFromRaw(Raw::Element e) {
result = convertDeclarationFromRaw(e)
or
result = convertExprFromRaw(e)
or
result = convertMatchArmFromRaw(e)
or
result = convertPatFromRaw(e)
or
result = convertStmtFromRaw(e)
or
result = convertTypeRefFromRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TBlock`, if possible.
*/
cached
TBlock convertBlockFromRaw(Raw::Element e) {
result = convertAsyncFromRaw(e)
result = convertAsyncBlockFromRaw(e)
or
result = convertUnsafeFromRaw(e)
result = convertUnsafeBlockFromRaw(e)
}
/**
@@ -811,7 +835,7 @@ module Synth {
or
result = convertTupleFromRaw(e)
or
result = convertUnaryExprFromRaw(e)
result = convertUnaryOpFromRaw(e)
or
result = convertUnderscoreFromRaw(e)
or
@@ -836,19 +860,7 @@ module Synth {
* Converts a raw DB element to a synthesized `TLocatable`, if possible.
*/
cached
TLocatable convertLocatableFromRaw(Raw::Element e) {
result = convertDeclarationFromRaw(e)
or
result = convertExprFromRaw(e)
or
result = convertMatchArmFromRaw(e)
or
result = convertPatFromRaw(e)
or
result = convertStmtFromRaw(e)
or
result = convertTypeRefFromRaw(e)
}
TLocatable convertLocatableFromRaw(Raw::Element e) { result = convertAstNodeFromRaw(e) }
/**
* INTERNAL: Do not use.
@@ -918,10 +930,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a synthesized `TAsync` to a raw DB element, if possible.
* Converts a synthesized `TAsyncBlock` to a raw DB element, if possible.
*/
cached
Raw::Element convertAsyncToRaw(TAsync e) { e = TAsync(result) }
Raw::Element convertAsyncBlockToRaw(TAsyncBlock e) { e = TAsyncBlock(result) }
/**
* INTERNAL: Do not use.
@@ -1268,10 +1280,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a synthesized `TUnaryExpr` to a raw DB element, if possible.
* Converts a synthesized `TUnaryOp` to a raw DB element, if possible.
*/
cached
Raw::Element convertUnaryExprToRaw(TUnaryExpr e) { e = TUnaryExpr(result) }
Raw::Element convertUnaryOpToRaw(TUnaryOp e) { e = TUnaryOp(result) }
/**
* INTERNAL: Do not use.
@@ -1296,10 +1308,10 @@ module Synth {
/**
* INTERNAL: Do not use.
* Converts a synthesized `TUnsafe` to a raw DB element, if possible.
* Converts a synthesized `TUnsafeBlock` to a raw DB element, if possible.
*/
cached
Raw::Element convertUnsafeToRaw(TUnsafe e) { e = TUnsafe(result) }
Raw::Element convertUnsafeBlockToRaw(TUnsafeBlock e) { e = TUnsafeBlock(result) }
/**
* INTERNAL: Do not use.
@@ -1322,15 +1334,34 @@ module Synth {
cached
Raw::Element convertYieldToRaw(TYield e) { e = TYield(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TAstNode` to a raw DB element, if possible.
*/
cached
Raw::Element convertAstNodeToRaw(TAstNode e) {
result = convertDeclarationToRaw(e)
or
result = convertExprToRaw(e)
or
result = convertMatchArmToRaw(e)
or
result = convertPatToRaw(e)
or
result = convertStmtToRaw(e)
or
result = convertTypeRefToRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TBlock` to a raw DB element, if possible.
*/
cached
Raw::Element convertBlockToRaw(TBlock e) {
result = convertAsyncToRaw(e)
result = convertAsyncBlockToRaw(e)
or
result = convertUnsafeToRaw(e)
result = convertUnsafeBlockToRaw(e)
}
/**
@@ -1421,7 +1452,7 @@ module Synth {
or
result = convertTupleToRaw(e)
or
result = convertUnaryExprToRaw(e)
result = convertUnaryOpToRaw(e)
or
result = convertUnderscoreToRaw(e)
or
@@ -1446,19 +1477,7 @@ module Synth {
* Converts a synthesized `TLocatable` to a raw DB element, if possible.
*/
cached
Raw::Element convertLocatableToRaw(TLocatable e) {
result = convertDeclarationToRaw(e)
or
result = convertExprToRaw(e)
or
result = convertMatchArmToRaw(e)
or
result = convertPatToRaw(e)
or
result = convertStmtToRaw(e)
or
result = convertTypeRefToRaw(e)
}
Raw::Element convertLocatableToRaw(TLocatable e) { result = convertAstNodeToRaw(e) }
/**
* INTERNAL: Do not use.

View File

@@ -4,7 +4,7 @@
*/
import codeql.rust.elements.ArrayConstructor
import codeql.rust.elements.AsyncConstructor
import codeql.rust.elements.AsyncBlockConstructor
import codeql.rust.elements.AwaitConstructor
import codeql.rust.elements.BecomeConstructor
import codeql.rust.elements.BinaryOpConstructor
@@ -54,9 +54,9 @@ import codeql.rust.elements.TupleConstructor
import codeql.rust.elements.TuplePatConstructor
import codeql.rust.elements.TupleStructPatConstructor
import codeql.rust.elements.TypeRefConstructor
import codeql.rust.elements.UnaryExprConstructor
import codeql.rust.elements.UnaryOpConstructor
import codeql.rust.elements.UnderscoreConstructor
import codeql.rust.elements.UnsafeConstructor
import codeql.rust.elements.UnsafeBlockConstructor
import codeql.rust.elements.WildPatConstructor
import codeql.rust.elements.YeetConstructor
import codeql.rust.elements.YieldConstructor

View File

@@ -6,7 +6,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Locatable
import codeql.rust.elements.AstNode
/**
* INTERNAL: This module contains the fully generated definition of `TypeRef` and should not
@@ -17,7 +17,7 @@ module Generated {
* INTERNAL: Do not reference the `Generated::TypeRef` class directly.
* Use the subclass `TypeRef`, where the following predicates are available.
*/
class TypeRef extends Synth::TTypeRef, Locatable {
class TypeRef extends Synth::TTypeRef, AstNode {
override string getAPrimaryQlClass() { result = "TypeRef" }
}
}

View File

@@ -1,36 +0,0 @@
// generated by codegen
/**
* This module provides the generated definition of `UnaryExpr`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Expr
/**
* INTERNAL: This module contains the fully generated definition of `UnaryExpr` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::UnaryExpr` class directly.
* Use the subclass `UnaryExpr`, where the following predicates are available.
*/
class UnaryExpr extends Synth::TUnaryExpr, Expr {
override string getAPrimaryQlClass() { result = "UnaryExpr" }
/**
* Gets the expression of this unary expression.
*/
Expr getExpr() {
result =
Synth::convertExprFromRaw(Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getExpr())
}
/**
* Gets the op of this unary expression.
*/
string getOp() { result = Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getOp() }
}
}

View File

@@ -0,0 +1,35 @@
// generated by codegen
/**
* This module provides the generated definition of `UnaryOp`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Expr
/**
* INTERNAL: This module contains the fully generated definition of `UnaryOp` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::UnaryOp` class directly.
* Use the subclass `UnaryOp`, where the following predicates are available.
*/
class UnaryOp extends Synth::TUnaryOp, Expr {
override string getAPrimaryQlClass() { result = "UnaryOp" }
/**
* Gets the expression of this unary op.
*/
Expr getExpr() {
result = Synth::convertExprFromRaw(Synth::convertUnaryOpToRaw(this).(Raw::UnaryOp).getExpr())
}
/**
* Gets the op of this unary op.
*/
string getOp() { result = Synth::convertUnaryOpToRaw(this).(Raw::UnaryOp).getOp() }
}
}

View File

@@ -1,23 +0,0 @@
// generated by codegen
/**
* This module provides the generated definition of `Unsafe`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Block
/**
* INTERNAL: This module contains the fully generated definition of `Unsafe` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::Unsafe` class directly.
* Use the subclass `Unsafe`, where the following predicates are available.
*/
class Unsafe extends Synth::TUnsafe, Block {
override string getAPrimaryQlClass() { result = "Unsafe" }
}
}

View File

@@ -0,0 +1,23 @@
// generated by codegen
/**
* This module provides the generated definition of `UnsafeBlock`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Block
/**
* INTERNAL: This module contains the fully generated definition of `UnsafeBlock` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::UnsafeBlock` class directly.
* Use the subclass `UnsafeBlock`, where the following predicates are available.
*/
class UnsafeBlock extends Synth::TUnsafeBlock, Block {
override string getAPrimaryQlClass() { result = "UnsafeBlock" }
}
}