C++: Bring back the StackVariable QL class

The new `StackVariable` class actually denotes what its name suggests.
This commit is contained in:
Jonas Jensen
2019-11-18 13:33:27 +01:00
parent 351cb46bb9
commit 8110039e0a
3 changed files with 24 additions and 19 deletions

View File

@@ -307,8 +307,8 @@ class ParameterDeclarationEntry extends VariableDeclarationEntry {
* }
* ```
*
* Local variables can be static; use the `isStatic` member predicate to
* detect those.
* See also `StackVariable`, which is the class of local-scope variables
* without statics and thread-locals.
*/
class LocalScopeVariable extends Variable, @localscopevariable {
/** Gets the function to which this variable belongs. */
@@ -316,12 +316,21 @@ class LocalScopeVariable extends Variable, @localscopevariable {
}
/**
* DEPRECATED: use `LocalScopeVariable` instead.
* A C/C++ variable with _automatic storage duration_. In other words, a
* function parameter or a local variable that is not static or thread-local.
* For example, the variables `a` and `b` in the following code.
* ```
* void myFunction(int a) {
* int b;
* static int c;
* }
* ```
*/
deprecated class StackVariable extends Variable {
StackVariable() { this instanceof LocalScopeVariable }
Function getFunction() { result = this.(LocalScopeVariable).getFunction() }
class StackVariable extends LocalScopeVariable {
StackVariable() {
not this.isStatic() and
not this.isThreadLocal()
}
}
/**
@@ -496,7 +505,7 @@ class TemplateVariable extends Variable {
* `myTemplateFunction<T>`:
* ```
* void myFunction() {
* T a;
* float a;
* }
*
* template<type T>
@@ -509,9 +518,6 @@ class TemplateVariable extends Variable {
* myTemplateFunction<int>();
* ```
*/
class SemanticStackVariable extends LocalScopeVariable {
SemanticStackVariable() {
not this.isStatic() and
not this.isFromUninstantiatedTemplate(_)
}
class SemanticStackVariable extends StackVariable {
SemanticStackVariable() { not this.isFromUninstantiatedTemplate(_) }
}