зеркало из https://github.com/github/codeql.git
Merge pull request #3929 from igfoo/static_assert
C++: Give static assertions an enclosing element
This commit is contained in:
Коммит
c7b668193b
|
@ -197,7 +197,8 @@ class Element extends ElementBase {
|
|||
initialisers(underlyingElement(this), unresolveElement(result), _, _) or
|
||||
exprconv(unresolveElement(result), underlyingElement(this)) or
|
||||
param_decl_bind(underlyingElement(this), _, unresolveElement(result)) or
|
||||
using_container(unresolveElement(result), underlyingElement(this))
|
||||
using_container(unresolveElement(result), underlyingElement(this)) or
|
||||
static_asserts(unresolveElement(this), _, _, _, underlyingElement(result))
|
||||
}
|
||||
|
||||
/** Gets the closest `Element` enclosing this one. */
|
||||
|
@ -278,12 +279,12 @@ class StaticAssert extends Locatable, @static_assert {
|
|||
/**
|
||||
* Gets the expression which this static assertion ensures is true.
|
||||
*/
|
||||
Expr getCondition() { static_asserts(underlyingElement(this), unresolveElement(result), _, _) }
|
||||
Expr getCondition() { static_asserts(underlyingElement(this), unresolveElement(result), _, _, _) }
|
||||
|
||||
/**
|
||||
* Gets the message which will be reported by the compiler if this static assertion fails.
|
||||
*/
|
||||
string getMessage() { static_asserts(underlyingElement(this), _, result, _) }
|
||||
string getMessage() { static_asserts(underlyingElement(this), _, result, _, _) }
|
||||
|
||||
override Location getLocation() { static_asserts(underlyingElement(this), _, _, result) }
|
||||
override Location getLocation() { static_asserts(underlyingElement(this), _, _, result, _) }
|
||||
}
|
||||
|
|
|
@ -508,7 +508,8 @@ static_asserts(
|
|||
unique int id: @static_assert,
|
||||
int condition : @expr ref,
|
||||
string message : string ref,
|
||||
int location: @location_default ref
|
||||
int location: @location_default ref,
|
||||
int enclosing : @element ref
|
||||
);
|
||||
|
||||
// each function has an ordered list of parameters
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,21 @@
|
|||
class StaticAssert extends @static_assert {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Expr extends @expr {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class NameSpace extends @namespace {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from StaticAssert sa, Expr condition, string message, Location loc, NameSpace ns
|
||||
where
|
||||
static_asserts(sa, condition, message, loc) and
|
||||
namespaces(ns, "")
|
||||
select sa, condition, message, loc, ns
|
|
@ -0,0 +1,4 @@
|
|||
description: Give static_assert's an enclosing element
|
||||
compatibility: partial
|
||||
static_asserts.rel: run static_asserts.qlo
|
||||
|
Загрузка…
Ссылка в новой задаче