mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Add upgrade and downgrade script
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
class Element extends @element {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Expr extends @expr {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Stmt extends @stmt {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isStmtWithInitializer(Stmt stmt) {
|
||||||
|
exists(int kind | stmts(stmt, kind, _) | kind = 2 or kind = 11 or kind = 35)
|
||||||
|
}
|
||||||
|
|
||||||
|
from Expr child, int index, int index_new, Element parent
|
||||||
|
where
|
||||||
|
exprparents(child, index, parent) and
|
||||||
|
if isStmtWithInitializer(parent) then index_new = index - 1 else index_new = index
|
||||||
|
select child, index_new, parent
|
||||||
2111
cpp/downgrades/cf72c8898d19eb1b3374432cf79d8276cb07ad43/old.dbscheme
Normal file
2111
cpp/downgrades/cf72c8898d19eb1b3374432cf79d8276cb07ad43/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
|||||||
|
class Element extends @element {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Stmt extends @stmt {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isStmtWithInitializer(Stmt stmt) {
|
||||||
|
exists(int kind | stmts(stmt, kind, _) | kind = 2 or kind = 11 or kind = 35)
|
||||||
|
}
|
||||||
|
|
||||||
|
from Stmt child, int index, int index_new, Element parent
|
||||||
|
where
|
||||||
|
stmtparents(child, index, parent) and
|
||||||
|
(
|
||||||
|
not isStmtWithInitializer(parent)
|
||||||
|
or
|
||||||
|
index > 0
|
||||||
|
) and
|
||||||
|
if isStmtWithInitializer(parent) then index_new = index - 1 else index_new = index
|
||||||
|
select child, index_new, parent
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
description: Support C++17 if and switch initializers
|
||||||
|
compatibility: partial
|
||||||
|
if_initialization.rel: delete
|
||||||
|
switch_initialization.rel: delete
|
||||||
|
exprparents.rel: run exprparents.qlo
|
||||||
|
stmtparents.rel: run stmtparents.qlo
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class Element extends @element {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Expr extends @expr {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Stmt extends @stmt {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isStmtWithInitializer(Stmt stmt) {
|
||||||
|
exists(int kind | stmts(stmt, kind, _) | kind = 2 or kind = 11 or kind = 35)
|
||||||
|
}
|
||||||
|
|
||||||
|
from Expr child, int index, int index_new, Element parent
|
||||||
|
where
|
||||||
|
exprparents(child, index, parent) and
|
||||||
|
if isStmtWithInitializer(parent) then index_new = index + 1 else index_new = index
|
||||||
|
select child, index_new, parent
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
|||||||
|
class Element extends @element {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Stmt extends @stmt {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isStmtWithInitializer(Stmt stmt) {
|
||||||
|
exists(int kind | stmts(stmt, kind, _) | kind = 2 or kind = 11 or kind = 35)
|
||||||
|
}
|
||||||
|
|
||||||
|
from Stmt child, int index, int index_new, Element parent
|
||||||
|
where
|
||||||
|
stmtparents(child, index, parent) and
|
||||||
|
if isStmtWithInitializer(parent) then index_new = index + 1 else index_new = index
|
||||||
|
select child, index_new, parent
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
description: Support C++17 if and switch initializers
|
||||||
|
compatibility: partial
|
||||||
|
exprparents.rel: run exprparents.qlo
|
||||||
|
stmtparents.rel: run stmtparents.qlo
|
||||||
Reference in New Issue
Block a user