mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: Introduce re-use expressions in the database scheme
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
class Expr extends @expr {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Location extends @location_expr {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
from Expr expr, int kind, int kind_new, Location loc
|
||||||
|
where
|
||||||
|
exprs(expr, kind, loc) and
|
||||||
|
if kind = 363 then kind_new = 1 else kind_new = kind
|
||||||
|
select expr, kind_new, loc
|
||||||
2250
cpp/downgrades/aa7ff0ab32cd4674f6ab731d32fea64116997b05/old.dbscheme
Normal file
2250
cpp/downgrades/aa7ff0ab32cd4674f6ab731d32fea64116997b05/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,4 @@
|
|||||||
|
description: Introduce re-use expressions
|
||||||
|
compatibility: partial
|
||||||
|
expr_reuse.rel: delete
|
||||||
|
exprs.rel: run exprs.qlo
|
||||||
@@ -1322,3 +1322,23 @@ class CoYieldExpr extends UnaryOperation, @co_yield {
|
|||||||
|
|
||||||
override int getPrecedence() { result = 2 }
|
override int getPrecedence() { result = 2 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An expression representing the re-use of another expression.
|
||||||
|
*
|
||||||
|
* In some specific cases an expression may be referred to outside its
|
||||||
|
* original context. A re-use expression wraps any such reference. A
|
||||||
|
* re-use expression can for example occur as the qualifier of an implicit
|
||||||
|
* destructor called on a temporary object, where the original use of the
|
||||||
|
* expression is in the definition of the temporary.
|
||||||
|
*/
|
||||||
|
class ReuseExpr extends Expr, @reuseexpr {
|
||||||
|
override string getAPrimaryQlClass() { result = "ReuseExpr" }
|
||||||
|
|
||||||
|
override string toString() { result = "reuse of " + this.getReusedExpr().toString() }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the expression that is being re-used.
|
||||||
|
*/
|
||||||
|
Expr getReusedExpr() { expr_reuse(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
}
|
||||||
|
|||||||
@@ -1513,6 +1513,11 @@ exprs(
|
|||||||
int location: @location_expr ref
|
int location: @location_expr ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expr_reuse(
|
||||||
|
int reuse: @expr ref,
|
||||||
|
int original: @expr ref
|
||||||
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
case @value.category of
|
case @value.category of
|
||||||
1 = prval
|
1 = prval
|
||||||
@@ -1741,6 +1746,7 @@ case @expr.kind of
|
|||||||
| 360 = @isunsigned
|
| 360 = @isunsigned
|
||||||
| 361 = @isvoid
|
| 361 = @isvoid
|
||||||
| 362 = @isvolatile
|
| 362 = @isvolatile
|
||||||
|
| 363 = @reuseexpr
|
||||||
;
|
;
|
||||||
|
|
||||||
@var_args_expr = @vastartexpr
|
@var_args_expr = @vastartexpr
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Introduce re-use expressions
|
||||||
|
compatibility: backwards
|
||||||
Reference in New Issue
Block a user