mirror of
https://github.com/github/codeql.git
synced 2026-02-12 05:01:06 +01:00
Rust: Add DB downgrade script
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
class Element extends @element {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
newtype TAddedElement =
|
||||
TMacroBlockExpr(Element block) {
|
||||
block_exprs(block) and macro_call_macro_call_expansions(_, block)
|
||||
}
|
||||
|
||||
module Fresh = QlBuiltins::NewEntity<TAddedElement>;
|
||||
|
||||
class TNewElement = @element or Fresh::EntityId;
|
||||
|
||||
class NewElement extends TNewElement {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
query predicate new_macro_block_exprs(NewElement id) { id = Fresh::map(TMacroBlockExpr(_)) }
|
||||
|
||||
query predicate new_macro_block_expr_statements(NewElement id, int index, Element stmt) {
|
||||
exists(Element block, Element list |
|
||||
id = Fresh::map(TMacroBlockExpr(block)) and
|
||||
block_expr_stmt_lists(block, list) and
|
||||
stmt_list_statements(list, index, stmt)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate new_macro_block_expr_tail_exprs(NewElement id, Element expr) {
|
||||
exists(Element block, Element list |
|
||||
id = Fresh::map(TMacroBlockExpr(block)) and
|
||||
block_expr_stmt_lists(block, list) and
|
||||
stmt_list_tail_exprs(list, expr)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate new_block_exprs(Element id) {
|
||||
block_exprs(id) and
|
||||
not macro_call_macro_call_expansions(_, id)
|
||||
}
|
||||
|
||||
query predicate new_stmt_lists(Element id) {
|
||||
stmt_lists(id) and
|
||||
not exists(Element block |
|
||||
macro_call_macro_call_expansions(_, block) and
|
||||
block_expr_stmt_lists(block, id)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate new_block_expr_stmt_lists(Element id, Element list) {
|
||||
block_expr_stmt_lists(id, list) and
|
||||
not macro_call_macro_call_expansions(_, id)
|
||||
}
|
||||
|
||||
query predicate new_stmt_list_statements(Element id, int index, Element stmt) {
|
||||
stmt_list_statements(id, index, stmt) and
|
||||
not exists(Element block |
|
||||
macro_call_macro_call_expansions(_, block) and
|
||||
block_expr_stmt_lists(block, id)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate new_stmt_list_tail_exprs(Element id, Element expr) {
|
||||
stmt_list_tail_exprs(id, expr) and
|
||||
not exists(Element block |
|
||||
macro_call_macro_call_expansions(_, block) and
|
||||
block_expr_stmt_lists(block, id)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate new_macro_call_macro_call_expansions(NewElement id, NewElement expansion) {
|
||||
macro_call_macro_call_expansions(id, expansion) and
|
||||
not block_exprs(expansion)
|
||||
or
|
||||
exists(Element block |
|
||||
expansion = Fresh::map(TMacroBlockExpr(block)) and
|
||||
macro_call_macro_call_expansions(id, block)
|
||||
)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
description: Unmerge the relations `macro_block_exprs` and `block_exprs`
|
||||
compatibility: full
|
||||
|
||||
macro_block_exprs.rel: run downgrade.ql new_macro_block_exprs
|
||||
macro_block_expr_statements.rel: run downgrade.ql new_macro_block_expr_statements
|
||||
macro_block_expr_tail_exprs.rel: run downgrade.ql new_macro_block_expr_tail_exprs
|
||||
|
||||
block_exprs.rel: run downgrade.ql new_block_exprs
|
||||
stmt_lists.rel: run downgrade.ql new_stmt_lists
|
||||
block_expr_stmt_lists.rel: run downgrade.ql new_block_expr_stmt_lists
|
||||
stmt_list_statements.rel: run downgrade.ql new_stmt_list_statements
|
||||
stmt_list_tail_exprs.rel: run downgrade.ql new_stmt_list_tail_exprs
|
||||
macro_call_macro_call_expansions.rel: run downgrade.ql new_macro_call_macro_call_expansions
|
||||
Reference in New Issue
Block a user