mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Don't unresolve 'this'
For example, if you have 3 types called T, where t1 and t2 are defined
but t3 isn't, then you will have
unspecifiedtype(t1, t1)
unspecifiedtype(t2, t2)
unspecifiedtype(t3, t3)
t1 = resolve(t1)
t1 = resolve(t3)
t2 = resolve(t2)
t2 = resolve(t3)
so given
Type getUnspecifiedType() {
unspecifiedtype(unresolve(this), unresolve(result))
}
you get t1.getUnspecifiedType() = t2.
I think that in general the best thing to do is to not unresolve 'this',
but to just take the underlying value.
This commit is contained in:
@@ -35,7 +35,7 @@ class AutogeneratedFile extends File {
|
|||||||
cached AutogeneratedFile() {
|
cached AutogeneratedFile() {
|
||||||
exists(int limit, int head |
|
exists(int limit, int head |
|
||||||
head <= 5 and
|
head <= 5 and
|
||||||
limit = max(int line | locations_default(_, unresolveElement(this), head, _, line, _)) + 5
|
limit = max(int line | locations_default(_, underlyingElement(this), head, _, line, _)) + 5
|
||||||
|
|
|
|
||||||
exists (Comment c | c.getFile() = this and c.getLocation().getStartLine() <= limit and isAutogeneratedComment(c))
|
exists (Comment c | c.getFile() = this and c.getLocation().getStartLine() <= limit and isAutogeneratedComment(c))
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ private import semmle.code.cpp.internal.Type
|
|||||||
*/
|
*/
|
||||||
class Class extends UserType {
|
class Class extends UserType {
|
||||||
Class() {
|
Class() {
|
||||||
isClass(unresolveElement(this))
|
isClass(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a child declaration of this class. */
|
/** Gets a child declaration of this class. */
|
||||||
@@ -75,7 +75,7 @@ class Class extends UserType {
|
|||||||
* If you also want template instantiations of results, see
|
* If you also want template instantiations of results, see
|
||||||
* `getAMember(int)`.
|
* `getAMember(int)`.
|
||||||
*/
|
*/
|
||||||
Declaration getCanonicalMember(int index) { member(unresolveElement(this),index,unresolveElement(result)) }
|
Declaration getCanonicalMember(int index) { member(underlyingElement(this),index,unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the (zero-based) `index`th canonical member declared in this
|
* Gets the (zero-based) `index`th canonical member declared in this
|
||||||
@@ -94,7 +94,7 @@ class Class extends UserType {
|
|||||||
* DEPRECATED: Use `getCanonicalMember(int)` or `getAMember(int)` instead.
|
* DEPRECATED: Use `getCanonicalMember(int)` or `getAMember(int)` instead.
|
||||||
* Gets the `index`th member of this class.
|
* Gets the `index`th member of this class.
|
||||||
*/
|
*/
|
||||||
deprecated Declaration getMember(int index) { member(unresolveElement(this),index,unresolveElement(result)) }
|
deprecated Declaration getMember(int index) { member(underlyingElement(this),index,unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: As this includes a somewhat arbitrary number of
|
* DEPRECATED: As this includes a somewhat arbitrary number of
|
||||||
@@ -416,7 +416,7 @@ class Class extends UserType {
|
|||||||
* compiled for. For this reason, the `is_pod_class` predicate is
|
* compiled for. For this reason, the `is_pod_class` predicate is
|
||||||
* generated by the extractor.
|
* generated by the extractor.
|
||||||
*/
|
*/
|
||||||
predicate isPOD() { is_pod_class(unresolveElement(this)) }
|
predicate isPOD() { is_pod_class(underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this class is abstract, in other words whether it declares one
|
* Holds if this class is abstract, in other words whether it declares one
|
||||||
@@ -513,7 +513,7 @@ class Class extends UserType {
|
|||||||
* classes.
|
* classes.
|
||||||
*/
|
*/
|
||||||
int getVirtualBaseClassByteOffset(Class base) {
|
int getVirtualBaseClassByteOffset(Class base) {
|
||||||
virtual_base_offsets(unresolveElement(this), unresolveElement(base), result)
|
virtual_base_offsets(underlyingElement(this), unresolveElement(base), result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -566,7 +566,7 @@ class Class extends UserType {
|
|||||||
* The alignment of this type in bytes (on the machine where facts were
|
* The alignment of this type in bytes (on the machine where facts were
|
||||||
* extracted).
|
* extracted).
|
||||||
*/
|
*/
|
||||||
int getAlignment() { usertypesize(unresolveElement(this),_,result) }
|
int getAlignment() { usertypesize(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this class is constructed from another class as a result of
|
* Holds if this class is constructed from another class as a result of
|
||||||
@@ -574,7 +574,7 @@ class Class extends UserType {
|
|||||||
* from a class nested in a class template.
|
* from a class nested in a class template.
|
||||||
*/
|
*/
|
||||||
predicate isConstructedFrom(Class c) {
|
predicate isConstructedFrom(Class c) {
|
||||||
class_instantiation(unresolveElement(this), unresolveElement(c))
|
class_instantiation(underlyingElement(this), unresolveElement(c))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -597,7 +597,7 @@ class Class extends UserType {
|
|||||||
* `i`th template parameter.
|
* `i`th template parameter.
|
||||||
*/
|
*/
|
||||||
Type getTemplateArgument(int i) {
|
Type getTemplateArgument(int i) {
|
||||||
class_template_argument(unresolveElement(this),i,unresolveElement(result))
|
class_template_argument(underlyingElement(this),i,unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -614,7 +614,7 @@ class Class extends UserType {
|
|||||||
|
|
||||||
/** Holds if this class was declared 'final'. */
|
/** Holds if this class was declared 'final'. */
|
||||||
predicate isFinal() {
|
predicate isFinal() {
|
||||||
usertype_final(unresolveElement(this))
|
usertype_final(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a link target which references this class. */
|
/** Gets a link target which references this class. */
|
||||||
@@ -631,7 +631,7 @@ class Class extends UserType {
|
|||||||
* using lowercase letters (e.g. "01234567-89ab-cdef-0123-456789abcdef").
|
* using lowercase letters (e.g. "01234567-89ab-cdef-0123-456789abcdef").
|
||||||
*/
|
*/
|
||||||
string getUuid() {
|
string getUuid() {
|
||||||
usertype_uuid(unresolveElement(this), result)
|
usertype_uuid(underlyingElement(this), result)
|
||||||
}
|
}
|
||||||
|
|
||||||
private Type getAFieldSubobjectType() {
|
private Type getAFieldSubobjectType() {
|
||||||
@@ -764,7 +764,7 @@ class ClassDerivation extends Locatable, @derivation {
|
|||||||
* struct D : T {};
|
* struct D : T {};
|
||||||
*/
|
*/
|
||||||
Type getBaseType() {
|
Type getBaseType() {
|
||||||
derivations(unresolveElement(this),_,_,unresolveElement(result),_)
|
derivations(underlyingElement(this),_,_,unresolveElement(result),_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -775,7 +775,7 @@ class ClassDerivation extends Locatable, @derivation {
|
|||||||
* struct D : B {};
|
* struct D : B {};
|
||||||
*/
|
*/
|
||||||
Class getDerivedClass() {
|
Class getDerivedClass() {
|
||||||
derivations(unresolveElement(this),unresolveElement(result),_,_,_)
|
derivations(underlyingElement(this),unresolveElement(result),_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -784,12 +784,12 @@ class ClassDerivation extends Locatable, @derivation {
|
|||||||
* derivation of B2 in "struct D : B1, B2 { ... };" would be 1.
|
* derivation of B2 in "struct D : B1, B2 { ... };" would be 1.
|
||||||
*/
|
*/
|
||||||
int getIndex() {
|
int getIndex() {
|
||||||
derivations(unresolveElement(this),_,result,_,_)
|
derivations(underlyingElement(this),_,result,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a specifier (for example "public") applied to the derivation. */
|
/** Gets a specifier (for example "public") applied to the derivation. */
|
||||||
Specifier getASpecifier() {
|
Specifier getASpecifier() {
|
||||||
derspecifiers(unresolveElement(this),unresolveElement(result))
|
derspecifiers(underlyingElement(this),unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if the derivation has specifier `s`. */
|
/** Holds if the derivation has specifier `s`. */
|
||||||
@@ -804,7 +804,7 @@ class ClassDerivation extends Locatable, @derivation {
|
|||||||
|
|
||||||
/** Gets the location of the derivation. */
|
/** Gets the location of the derivation. */
|
||||||
override Location getLocation() {
|
override Location getLocation() {
|
||||||
derivations(unresolveElement(this),_,_,_,result)
|
derivations(underlyingElement(this),_,_,_,result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -816,7 +816,7 @@ class ClassDerivation extends Locatable, @derivation {
|
|||||||
* classes.
|
* classes.
|
||||||
*/
|
*/
|
||||||
int getByteOffset() {
|
int getByteOffset() {
|
||||||
direct_base_offsets(unresolveElement(this), result)
|
direct_base_offsets(underlyingElement(this), result)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
@@ -869,7 +869,7 @@ class AbstractClass extends Class {
|
|||||||
* of class templates).
|
* of class templates).
|
||||||
*/
|
*/
|
||||||
class TemplateClass extends Class {
|
class TemplateClass extends Class {
|
||||||
TemplateClass() { usertypes(unresolveElement(this),_,6) }
|
TemplateClass() { usertypes(underlyingElement(this),_,6) }
|
||||||
Class getAnInstantiation() {
|
Class getAnInstantiation() {
|
||||||
result.isConstructedFrom(this) and
|
result.isConstructedFrom(this) and
|
||||||
exists(result.getATemplateArgument())
|
exists(result.getATemplateArgument())
|
||||||
@@ -998,7 +998,7 @@ class VirtualBaseClass extends Class {
|
|||||||
*/
|
*/
|
||||||
class ProxyClass extends UserType {
|
class ProxyClass extends UserType {
|
||||||
ProxyClass() {
|
ProxyClass() {
|
||||||
usertypes(unresolveElement(this),_,9)
|
usertypes(underlyingElement(this),_,9)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the location of the proxy class. */
|
/** Gets the location of the proxy class. */
|
||||||
@@ -1008,7 +1008,7 @@ class ProxyClass extends UserType {
|
|||||||
|
|
||||||
/** Gets the template parameter for which this is the proxy class. */
|
/** Gets the template parameter for which this is the proxy class. */
|
||||||
TemplateParameter getTemplateParameter() {
|
TemplateParameter getTemplateParameter() {
|
||||||
is_proxy_class_for(unresolveElement(this),unresolveElement(result))
|
is_proxy_class_for(underlyingElement(this),unresolveElement(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import semmle.code.cpp.Element
|
|||||||
*/
|
*/
|
||||||
class Comment extends Locatable, @comment {
|
class Comment extends Locatable, @comment {
|
||||||
override string toString() { result = this.getContents() }
|
override string toString() { result = this.getContents() }
|
||||||
override Location getLocation() { comments(unresolveElement(this),_,result) }
|
override Location getLocation() { comments(underlyingElement(this),_,result) }
|
||||||
string getContents() { comments(unresolveElement(this),result,_) }
|
string getContents() { comments(underlyingElement(this),result,_) }
|
||||||
Element getCommentedElement() { commentbinding(unresolveElement(this),unresolveElement(result)) }
|
Element getCommentedElement() { commentbinding(underlyingElement(this),unresolveElement(result)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,26 +7,26 @@ class Diagnostic extends Locatable, @diagnostic {
|
|||||||
* Gets the severity of the message, on a range from 1 to 5: 1=remark,
|
* Gets the severity of the message, on a range from 1 to 5: 1=remark,
|
||||||
* 2=warning, 3=discretionary error, 4=error, 5=catastrophic error.
|
* 2=warning, 3=discretionary error, 4=error, 5=catastrophic error.
|
||||||
*/
|
*/
|
||||||
int getSeverity() { diagnostics(unresolveElement(this), result, _, _, _, _) }
|
int getSeverity() { diagnostics(underlyingElement(this), result, _, _, _, _) }
|
||||||
|
|
||||||
/** Gets the error code for this compiler message. */
|
/** Gets the error code for this compiler message. */
|
||||||
string getTag() { diagnostics(unresolveElement(this), _, result, _, _, _) }
|
string getTag() { diagnostics(underlyingElement(this), _, result, _, _, _) }
|
||||||
predicate hasTag(string s) { this.getTag() = s }
|
predicate hasTag(string s) { this.getTag() = s }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the error message text associated with this compiler
|
* Gets the error message text associated with this compiler
|
||||||
* diagnostic.
|
* diagnostic.
|
||||||
*/
|
*/
|
||||||
string getMessage() { diagnostics(unresolveElement(this), _, _, result, _, _) }
|
string getMessage() { diagnostics(underlyingElement(this), _, _, result, _, _) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the full error message text associated with this compiler
|
* Gets the full error message text associated with this compiler
|
||||||
* diagnostic.
|
* diagnostic.
|
||||||
*/
|
*/
|
||||||
string getFullMessage() { diagnostics(unresolveElement(this), _, _, _, result, _) }
|
string getFullMessage() { diagnostics(underlyingElement(this), _, _, _, result, _) }
|
||||||
|
|
||||||
/** Gets the source location corresponding to the compiler message. */
|
/** Gets the source location corresponding to the compiler message. */
|
||||||
override Location getLocation() { diagnostics(unresolveElement(this), _, _, _, _, result) }
|
override Location getLocation() { diagnostics(underlyingElement(this), _, _, _, _, result) }
|
||||||
|
|
||||||
override string toString() { result = this.getMessage() }
|
override string toString() { result = this.getMessage() }
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ cached @element unresolveElement(Element e) {
|
|||||||
resolveElement(result) = e
|
resolveElement(result) = e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cached @element underlyingElement(Element e) {
|
||||||
|
result = e
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C/C++ element. This class is the base class for all C/C++
|
* A C/C++ element. This class is the base class for all C/C++
|
||||||
* elements, such as functions, classes, expressions, and so on.
|
* elements, such as functions, classes, expressions, and so on.
|
||||||
@@ -136,7 +140,7 @@ class Element extends @element {
|
|||||||
| this = s and result = s.getParent())
|
| this = s and result = s.getParent())
|
||||||
|
|
||||||
or
|
or
|
||||||
using_container(unresolveElement(result), unresolveElement(this))
|
using_container(unresolveElement(result), underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,17 +162,17 @@ class Element extends @element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Element getEnclosingElementPref() {
|
private Element getEnclosingElementPref() {
|
||||||
enclosingfunction(unresolveElement(this), unresolveElement(result)) or
|
enclosingfunction(underlyingElement(this), unresolveElement(result)) or
|
||||||
result.(Function) = stmtEnclosingElement(this) or
|
result.(Function) = stmtEnclosingElement(this) or
|
||||||
this.(LocalScopeVariable).getFunction() = result or
|
this.(LocalScopeVariable).getFunction() = result or
|
||||||
enumconstants(unresolveElement(this), unresolveElement(result), _, _, _, _) or
|
enumconstants(underlyingElement(this), unresolveElement(result), _, _, _, _) or
|
||||||
derivations(unresolveElement(this), unresolveElement(result), _, _, _) or
|
derivations(underlyingElement(this), unresolveElement(result), _, _, _) or
|
||||||
stmtparents(unresolveElement(this), _, unresolveElement(result)) or
|
stmtparents(underlyingElement(this), _, unresolveElement(result)) or
|
||||||
exprparents(unresolveElement(this), _, unresolveElement(result)) or
|
exprparents(underlyingElement(this), _, unresolveElement(result)) or
|
||||||
namequalifiers(unresolveElement(this), unresolveElement(result), _, _) or
|
namequalifiers(underlyingElement(this), unresolveElement(result), _, _) or
|
||||||
initialisers(unresolveElement(this), unresolveElement(result), _, _) or
|
initialisers(underlyingElement(this), unresolveElement(result), _, _) or
|
||||||
exprconv(unresolveElement(result), unresolveElement(this)) or
|
exprconv(unresolveElement(result), underlyingElement(this)) or
|
||||||
param_decl_bind(unresolveElement(this),_,unresolveElement(result))
|
param_decl_bind(underlyingElement(this),_,unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the closest `Element` enclosing this one. */
|
/** Gets the closest `Element` enclosing this one. */
|
||||||
@@ -181,7 +185,7 @@ class Element extends @element {
|
|||||||
or
|
or
|
||||||
result = exprEnclosingElement(this)
|
result = exprEnclosingElement(this)
|
||||||
or
|
or
|
||||||
var_decls(unresolveElement(this), unresolveElement(result), _, _, _)
|
var_decls(underlyingElement(this), unresolveElement(result), _, _, _)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -247,7 +251,7 @@ private predicate isFromUninstantiatedTemplateRec(Element e, Element template) {
|
|||||||
*/
|
*/
|
||||||
class StaticAssert extends Locatable, @static_assert {
|
class StaticAssert extends Locatable, @static_assert {
|
||||||
override string toString() { result = "static_assert(..., \"" + getMessage() + "\")" }
|
override string toString() { result = "static_assert(..., \"" + getMessage() + "\")" }
|
||||||
Expr getCondition() { static_asserts(unresolveElement(this), unresolveElement(result), _, _) }
|
Expr getCondition() { static_asserts(underlyingElement(this), unresolveElement(result), _, _) }
|
||||||
string getMessage() { static_asserts(unresolveElement(this), _, result, _) }
|
string getMessage() { static_asserts(underlyingElement(this), _, result, _) }
|
||||||
override Location getLocation() { static_asserts(unresolveElement(this), _, _, result) }
|
override Location getLocation() { static_asserts(underlyingElement(this), _, _, result) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ private import semmle.code.cpp.internal.Type
|
|||||||
class Enum extends UserType, IntegralOrEnumType {
|
class Enum extends UserType, IntegralOrEnumType {
|
||||||
/** Gets an enumerator of this enumeration. */
|
/** Gets an enumerator of this enumeration. */
|
||||||
EnumConstant getAnEnumConstant() { result.getDeclaringEnum() = this }
|
EnumConstant getAnEnumConstant() { result.getDeclaringEnum() = this }
|
||||||
EnumConstant getEnumConstant(int index) { enumconstants(unresolveElement(result),unresolveElement(this),index,_,_,_) }
|
EnumConstant getEnumConstant(int index) { enumconstants(unresolveElement(result),underlyingElement(this),index,_,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a descriptive string for the enum. This method is only intended to
|
* Gets a descriptive string for the enum. This method is only intended to
|
||||||
@@ -24,7 +24,7 @@ class Enum extends UserType, IntegralOrEnumType {
|
|||||||
* For example: `enum E : int`.
|
* For example: `enum E : int`.
|
||||||
*/
|
*/
|
||||||
predicate hasExplicitUnderlyingType() {
|
predicate hasExplicitUnderlyingType() {
|
||||||
derivations(_, unresolveElement(this), _, _, _)
|
derivations(_, underlyingElement(this), _, _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +32,7 @@ class Enum extends UserType, IntegralOrEnumType {
|
|||||||
* For example: `int` in `enum E : int`.
|
* For example: `int` in `enum E : int`.
|
||||||
*/
|
*/
|
||||||
Type getExplicitUnderlyingType() {
|
Type getExplicitUnderlyingType() {
|
||||||
derivations(_, unresolveElement(this), _, unresolveElement(result), _)
|
derivations(_, underlyingElement(this), _, unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class NestedEnum extends Enum {
|
|||||||
*/
|
*/
|
||||||
class ScopedEnum extends Enum {
|
class ScopedEnum extends Enum {
|
||||||
ScopedEnum() {
|
ScopedEnum() {
|
||||||
usertypes(unresolveElement(this),_,13)
|
usertypes(underlyingElement(this),_,13)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ class EnumConstant extends Declaration, @enumconstant {
|
|||||||
/**
|
/**
|
||||||
* Gets the enumeration of which this enumerator is a member.
|
* Gets the enumeration of which this enumerator is a member.
|
||||||
*/
|
*/
|
||||||
Enum getDeclaringEnum() { enumconstants(unresolveElement(this),unresolveElement(result),_,_,_,_) }
|
Enum getDeclaringEnum() { enumconstants(underlyingElement(this),unresolveElement(result),_,_,_,_) }
|
||||||
|
|
||||||
override Class getDeclaringType() {
|
override Class getDeclaringType() {
|
||||||
result = this.getDeclaringEnum().getDeclaringType()
|
result = this.getDeclaringEnum().getDeclaringType()
|
||||||
@@ -96,7 +96,7 @@ class EnumConstant extends Declaration, @enumconstant {
|
|||||||
/**
|
/**
|
||||||
* Gets the name of this enumerator.
|
* Gets the name of this enumerator.
|
||||||
*/
|
*/
|
||||||
override string getName() { enumconstants(unresolveElement(this),_,_,_,result,_) }
|
override string getName() { enumconstants(underlyingElement(this),_,_,_,result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value that this enumerator is initialized to, as a
|
* Gets the value that this enumerator is initialized to, as a
|
||||||
@@ -106,13 +106,13 @@ class EnumConstant extends Declaration, @enumconstant {
|
|||||||
string getValue() { result = this.getInitializer().getExpr().getValue() }
|
string getValue() { result = this.getInitializer().getExpr().getValue() }
|
||||||
|
|
||||||
/** Gets the type of this enumerator. */
|
/** Gets the type of this enumerator. */
|
||||||
Type getType() { enumconstants(unresolveElement(this),_,_,unresolveElement(result),_,_) }
|
Type getType() { enumconstants(underlyingElement(this),_,_,unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/** Gets the location of a declaration of this enumerator. */
|
/** Gets the location of a declaration of this enumerator. */
|
||||||
override Location getADeclarationLocation() { result = this.getDefinitionLocation() }
|
override Location getADeclarationLocation() { result = this.getDefinitionLocation() }
|
||||||
|
|
||||||
/** Gets the location of the definition of this enumerator. */
|
/** Gets the location of the definition of this enumerator. */
|
||||||
override Location getDefinitionLocation() { enumconstants(unresolveElement(this),_,_,_,_,result) }
|
override Location getDefinitionLocation() { enumconstants(underlyingElement(this),_,_,_,_,result) }
|
||||||
|
|
||||||
/** Gets the location of the definition of this enumerator. */
|
/** Gets the location of the definition of this enumerator. */
|
||||||
override Location getLocation() { result = this.getDefinitionLocation() }
|
override Location getLocation() { result = this.getDefinitionLocation() }
|
||||||
@@ -124,7 +124,7 @@ class EnumConstant extends Declaration, @enumconstant {
|
|||||||
EnumConstantAccess getAnAccess() { result.getTarget() = this }
|
EnumConstantAccess getAnAccess() { result.getTarget() = this }
|
||||||
|
|
||||||
/** Gets a specifier of this enumerator. */
|
/** Gets a specifier of this enumerator. */
|
||||||
override Specifier getASpecifier() { varspecifiers(unresolveElement(this),unresolveElement(result)) }
|
override Specifier getASpecifier() { varspecifiers(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An attribute of this enumerator.
|
* An attribute of this enumerator.
|
||||||
@@ -133,6 +133,6 @@ class EnumConstant extends Declaration, @enumconstant {
|
|||||||
* which is only supported by Clang.
|
* which is only supported by Clang.
|
||||||
*/
|
*/
|
||||||
Attribute getAnAttribute() {
|
Attribute getAnAttribute() {
|
||||||
varattributes(unresolveElement(this), unresolveElement(result))
|
varattributes(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import semmle.code.cpp.exprs.Access
|
|||||||
class Field extends MemberVariable {
|
class Field extends MemberVariable {
|
||||||
|
|
||||||
Field() {
|
Field() {
|
||||||
fieldoffsets(unresolveElement(this),_,_)
|
fieldoffsets(underlyingElement(this),_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the offset of this field in bytes from the start of its declaring
|
* Gets the offset of this field in bytes from the start of its declaring
|
||||||
* type (on the machine where facts were extracted).
|
* type (on the machine where facts were extracted).
|
||||||
*/
|
*/
|
||||||
int getByteOffset() { fieldoffsets(unresolveElement(this),result,_) }
|
int getByteOffset() { fieldoffsets(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the byte offset within `mostDerivedClass` of each occurence of this
|
* Gets the byte offset within `mostDerivedClass` of each occurence of this
|
||||||
@@ -70,13 +70,13 @@ class Field extends MemberVariable {
|
|||||||
* Syntactically, this looks like `int x : 3` in `struct S { int x : 3; };`.
|
* Syntactically, this looks like `int x : 3` in `struct S { int x : 3; };`.
|
||||||
*/
|
*/
|
||||||
class BitField extends Field {
|
class BitField extends Field {
|
||||||
BitField() { bitfield(unresolveElement(this),_,_) }
|
BitField() { bitfield(underlyingElement(this),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of this bitfield in bits (on the machine where facts
|
* Gets the size of this bitfield in bits (on the machine where facts
|
||||||
* were extracted).
|
* were extracted).
|
||||||
*/
|
*/
|
||||||
int getNumBits() { bitfield(unresolveElement(this),result,_) }
|
int getNumBits() { bitfield(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value which appeared after the colon in the bitfield
|
* Gets the value which appeared after the colon in the bitfield
|
||||||
@@ -88,13 +88,13 @@ class BitField extends Field {
|
|||||||
* `getNumBits` will give 32, whereas `getDeclaredNumBits` will give
|
* `getNumBits` will give 32, whereas `getDeclaredNumBits` will give
|
||||||
* 1234.
|
* 1234.
|
||||||
*/
|
*/
|
||||||
int getDeclaredNumBits() { bitfield(unresolveElement(this),_,result) }
|
int getDeclaredNumBits() { bitfield(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the offset of this bitfield in bits from the byte identified by
|
* Gets the offset of this bitfield in bits from the byte identified by
|
||||||
* getByteOffset (on the machine where facts were extracted).
|
* getByteOffset (on the machine where facts were extracted).
|
||||||
*/
|
*/
|
||||||
int getBitOffset() { fieldoffsets(unresolveElement(this),_,result) }
|
int getBitOffset() { fieldoffsets(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
predicate isAnonymous() {
|
predicate isAnonymous() {
|
||||||
hasName("(unnamed bitfield)")
|
hasName("(unnamed bitfield)")
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ abstract class Container extends Locatable, @container {
|
|||||||
|
|
||||||
/** Gets the parent container of this file or folder, if any. */
|
/** Gets the parent container of this file or folder, if any. */
|
||||||
Container getParentContainer() {
|
Container getParentContainer() {
|
||||||
containerparent(unresolveElement(result), unresolveElement(this))
|
containerparent(unresolveElement(result), underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a file or sub-folder in this container. */
|
/** Gets a file or sub-folder in this container. */
|
||||||
@@ -179,7 +179,7 @@ abstract class Container extends Locatable, @container {
|
|||||||
*/
|
*/
|
||||||
class Folder extends Container, @folder {
|
class Folder extends Container, @folder {
|
||||||
override string getAbsolutePath() {
|
override string getAbsolutePath() {
|
||||||
folders(unresolveElement(this), result, _)
|
folders(underlyingElement(this), result, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override Location getLocation() {
|
override Location getLocation() {
|
||||||
@@ -200,7 +200,7 @@ class Folder extends Container, @folder {
|
|||||||
* Gets the name of this folder.
|
* Gets the name of this folder.
|
||||||
*/
|
*/
|
||||||
deprecated
|
deprecated
|
||||||
string getName() { folders(unresolveElement(this),result,_) }
|
string getName() { folders(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: use `getAbsolutePath` instead.
|
* DEPRECATED: use `getAbsolutePath` instead.
|
||||||
@@ -223,7 +223,7 @@ class Folder extends Container, @folder {
|
|||||||
deprecated
|
deprecated
|
||||||
string getShortName() {
|
string getShortName() {
|
||||||
exists (string longnameRaw, string longname
|
exists (string longnameRaw, string longname
|
||||||
| folders(unresolveElement(this),_,longnameRaw) and
|
| folders(underlyingElement(this),_,longnameRaw) and
|
||||||
longname = longnameRaw.replaceAll("\\", "/")
|
longname = longnameRaw.replaceAll("\\", "/")
|
||||||
| exists (int index
|
| exists (int index
|
||||||
| result = longname.splitAt("/", index) and
|
| result = longname.splitAt("/", index) and
|
||||||
@@ -235,7 +235,7 @@ class Folder extends Container, @folder {
|
|||||||
* Gets the parent folder.
|
* Gets the parent folder.
|
||||||
*/
|
*/
|
||||||
deprecated
|
deprecated
|
||||||
Folder getParent() { containerparent(unresolveElement(result),unresolveElement(this)) }
|
Folder getParent() { containerparent(unresolveElement(result),underlyingElement(this)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,7 +252,7 @@ class Folder extends Container, @folder {
|
|||||||
*/
|
*/
|
||||||
class File extends Container, @file {
|
class File extends Container, @file {
|
||||||
override string getAbsolutePath() {
|
override string getAbsolutePath() {
|
||||||
files(unresolveElement(this), result, _, _, _)
|
files(underlyingElement(this), result, _, _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
@@ -274,12 +274,12 @@ class File extends Container, @file {
|
|||||||
|
|
||||||
/** Holds if this file was compiled as C (at any point). */
|
/** Holds if this file was compiled as C (at any point). */
|
||||||
predicate compiledAsC() {
|
predicate compiledAsC() {
|
||||||
fileannotations(unresolveElement(this),1,"compiled as c","1")
|
fileannotations(underlyingElement(this),1,"compiled as c","1")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this file was compiled as C++ (at any point). */
|
/** Holds if this file was compiled as C++ (at any point). */
|
||||||
predicate compiledAsCpp() {
|
predicate compiledAsCpp() {
|
||||||
fileannotations(unresolveElement(this),1,"compiled as c++","1")
|
fileannotations(underlyingElement(this),1,"compiled as c++","1")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -333,14 +333,14 @@ class File extends Container, @file {
|
|||||||
* Gets the folder which contains this file.
|
* Gets the folder which contains this file.
|
||||||
*/
|
*/
|
||||||
deprecated
|
deprecated
|
||||||
Folder getParent() { containerparent(unresolveElement(result),unresolveElement(this)) }
|
Folder getParent() { containerparent(unresolveElement(result),underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this file may be from source. This predicate holds for all files
|
* Holds if this file may be from source. This predicate holds for all files
|
||||||
* except the dummy file, whose name is the empty string, which contains
|
* except the dummy file, whose name is the empty string, which contains
|
||||||
* declarations that are built into the compiler.
|
* declarations that are built into the compiler.
|
||||||
*/
|
*/
|
||||||
override predicate fromSource() { numlines(unresolveElement(this),_,_,_) }
|
override predicate fromSource() { numlines(underlyingElement(this),_,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this file may be from a library.
|
* Holds if this file may be from a library.
|
||||||
@@ -359,7 +359,7 @@ class File extends Container, @file {
|
|||||||
* "/usr/home/me/myprogram.c".
|
* "/usr/home/me/myprogram.c".
|
||||||
*/
|
*/
|
||||||
deprecated
|
deprecated
|
||||||
string getName() { files(unresolveElement(this),result,_,_,_) }
|
string getName() { files(underlyingElement(this),result,_,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Use `getAbsolutePath` instead.
|
* DEPRECATED: Use `getAbsolutePath` instead.
|
||||||
@@ -391,7 +391,7 @@ class File extends Container, @file {
|
|||||||
* "tar.gz", while `getExtension` will have the result "gz".
|
* "tar.gz", while `getExtension` will have the result "gz".
|
||||||
*/
|
*/
|
||||||
string getExtensions() {
|
string getExtensions() {
|
||||||
files(unresolveElement(this),_,_,result,_)
|
files(underlyingElement(this),_,_,result,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,7 +424,7 @@ class File extends Container, @file {
|
|||||||
* for example, for "file.tar.gz", this predicate will have the result
|
* for example, for "file.tar.gz", this predicate will have the result
|
||||||
* "file", while `getStem` will have the result "file.tar".
|
* "file", while `getStem` will have the result "file.tar".
|
||||||
*/
|
*/
|
||||||
string getShortName() { files(unresolveElement(this),_,result,_,_) }
|
string getShortName() { files(underlyingElement(this),_,result,_,_) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class FriendDecl extends Declaration, @frienddecl {
|
|||||||
override Location getDefinitionLocation() { result = this.getLocation() }
|
override Location getDefinitionLocation() { result = this.getLocation() }
|
||||||
|
|
||||||
/** Gets the location of this friend declaration. */
|
/** Gets the location of this friend declaration. */
|
||||||
override Location getLocation() { frienddecls(unresolveElement(this),_,_,result) }
|
override Location getLocation() { frienddecls(underlyingElement(this),_,_,result) }
|
||||||
|
|
||||||
/** Gets a descriptive string for this friend declaration. */
|
/** Gets a descriptive string for this friend declaration. */
|
||||||
override string getName() {
|
override string getName() {
|
||||||
@@ -51,13 +51,13 @@ class FriendDecl extends Declaration, @frienddecl {
|
|||||||
* Gets the target of this friend declaration.
|
* Gets the target of this friend declaration.
|
||||||
* For example: `X` in `class A { friend class X }`.
|
* For example: `X` in `class A { friend class X }`.
|
||||||
*/
|
*/
|
||||||
AccessHolder getFriend() { frienddecls(unresolveElement(this),_,unresolveElement(result),_) }
|
AccessHolder getFriend() { frienddecls(underlyingElement(this),_,unresolveElement(result),_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the declaring class (also known as the befriending class).
|
* Gets the declaring class (also known as the befriending class).
|
||||||
* For example: `A` in `class A { friend class X }`.
|
* For example: `A` in `class A { friend class X }`.
|
||||||
*/
|
*/
|
||||||
Class getDeclaringClass() { frienddecls(unresolveElement(this),unresolveElement(result),_,_) }
|
Class getDeclaringClass() { frienddecls(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/* Holds if this declaration is a top-level declaration. */
|
/* Holds if this declaration is a top-level declaration. */
|
||||||
override predicate isTopLevel() { none() }
|
override predicate isTopLevel() { none() }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* To test whether a function has a particular name in the global
|
* To test whether a function has a particular name in the global
|
||||||
* namespace, use `hasGlobalName`.
|
* namespace, use `hasGlobalName`.
|
||||||
*/
|
*/
|
||||||
override string getName() { functions(unresolveElement(this),result,_) }
|
override string getName() { functions(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the full signature of this function, including return type, parameter
|
* Gets the full signature of this function, including return type, parameter
|
||||||
@@ -70,16 +70,16 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
|
|
||||||
/** Gets a specifier of this function. */
|
/** Gets a specifier of this function. */
|
||||||
override Specifier getASpecifier() {
|
override Specifier getASpecifier() {
|
||||||
funspecifiers(unresolveElement(this),unresolveElement(result))
|
funspecifiers(underlyingElement(this),unresolveElement(result))
|
||||||
or result.hasName(getADeclarationEntry().getASpecifier())
|
or result.hasName(getADeclarationEntry().getASpecifier())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets an attribute of this function. */
|
/** Gets an attribute of this function. */
|
||||||
Attribute getAnAttribute() { funcattributes(unresolveElement(this), unresolveElement(result)) }
|
Attribute getAnAttribute() { funcattributes(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/** Holds if this function is generated by the compiler. */
|
/** Holds if this function is generated by the compiler. */
|
||||||
predicate isCompilerGenerated() {
|
predicate isCompilerGenerated() {
|
||||||
compgenerated(unresolveElement(this))
|
compgenerated(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this function is inline. */
|
/** Holds if this function is inline. */
|
||||||
@@ -104,7 +104,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* whether a class would have had those members implicitly deleted.
|
* whether a class would have had those members implicitly deleted.
|
||||||
*/
|
*/
|
||||||
predicate isDeleted() {
|
predicate isDeleted() {
|
||||||
function_deleted(unresolveElement(this))
|
function_deleted(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +112,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* specifier.
|
* specifier.
|
||||||
*/
|
*/
|
||||||
predicate isDefaulted() {
|
predicate isDefaulted() {
|
||||||
function_defaulted(unresolveElement(this))
|
function_defaulted(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,13 +124,13 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the return type of this function. */
|
/** Gets the return type of this function. */
|
||||||
Type getType() { function_return_type(unresolveElement(this),unresolveElement(result)) }
|
Type getType() { function_return_type(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets the nth parameter of this function. */
|
/** Gets the nth parameter of this function. */
|
||||||
Parameter getParameter(int n) { params(unresolveElement(result),unresolveElement(this),n,_) }
|
Parameter getParameter(int n) { params(unresolveElement(result),underlyingElement(this),n,_) }
|
||||||
|
|
||||||
/** Gets a parameter of this function. */
|
/** Gets a parameter of this function. */
|
||||||
Parameter getAParameter() { params(unresolveElement(result),unresolveElement(this),_,_) }
|
Parameter getAParameter() { params(unresolveElement(result),underlyingElement(this),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the number of parameters of this function, _not_ including any
|
* Gets the number of parameters of this function, _not_ including any
|
||||||
@@ -183,14 +183,14 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* in `Declaration.qll`.
|
* in `Declaration.qll`.
|
||||||
*/
|
*/
|
||||||
override FunctionDeclarationEntry getADeclarationEntry() {
|
override FunctionDeclarationEntry getADeclarationEntry() {
|
||||||
if fun_decls(_,unresolveElement(this),_,_,_) then
|
if fun_decls(_,underlyingElement(this),_,_,_) then
|
||||||
declEntry(result)
|
declEntry(result)
|
||||||
else
|
else
|
||||||
exists(Function f | this.isConstructedFrom(f) and fun_decls(unresolveElement(result),unresolveElement(f),_,_,_))
|
exists(Function f | this.isConstructedFrom(f) and fun_decls(unresolveElement(result),unresolveElement(f),_,_,_))
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate declEntry(FunctionDeclarationEntry fde) {
|
private predicate declEntry(FunctionDeclarationEntry fde) {
|
||||||
fun_decls(unresolveElement(fde),unresolveElement(this),_,_,_) and
|
fun_decls(unresolveElement(fde),underlyingElement(this),_,_,_) and
|
||||||
// If one .cpp file specializes a function, and another calls the
|
// If one .cpp file specializes a function, and another calls the
|
||||||
// specialized function, then when extracting the second we only see an
|
// specialized function, then when extracting the second we only see an
|
||||||
// instantiation, not the specialization. We Therefore need to ignore
|
// instantiation, not the specialization. We Therefore need to ignore
|
||||||
@@ -208,7 +208,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
|
|
||||||
/** Holds if this Function is a Template specialization. */
|
/** Holds if this Function is a Template specialization. */
|
||||||
predicate isSpecialization() {
|
predicate isSpecialization() {
|
||||||
exists(FunctionDeclarationEntry fde | fun_decls(unresolveElement(fde),unresolveElement(this),_,_,_)
|
exists(FunctionDeclarationEntry fde | fun_decls(unresolveElement(fde),underlyingElement(this),_,_,_)
|
||||||
and fde.isSpecialization())
|
and fde.isSpecialization())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* `FunctionTryStmt`.
|
* `FunctionTryStmt`.
|
||||||
*/
|
*/
|
||||||
Stmt getEntryPoint() {
|
Stmt getEntryPoint() {
|
||||||
function_entry_point(unresolveElement(this), unresolveElement(result))
|
function_entry_point(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,7 +341,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* function or from a function nested in a template class.
|
* function or from a function nested in a template class.
|
||||||
*/
|
*/
|
||||||
predicate isConstructedFrom(Function f) {
|
predicate isConstructedFrom(Function f) {
|
||||||
function_instantiation(unresolveElement(this), unresolveElement(f))
|
function_instantiation(underlyingElement(this), unresolveElement(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -357,7 +357,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
* template class.
|
* template class.
|
||||||
*/
|
*/
|
||||||
Type getTemplateArgument(int index) {
|
Type getTemplateArgument(int index) {
|
||||||
function_template_argument(unresolveElement(this),index,unresolveElement(result))
|
function_template_argument(underlyingElement(this),index,unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -496,22 +496,22 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
override Function getDeclaration() { result = getFunction() }
|
override Function getDeclaration() { result = getFunction() }
|
||||||
|
|
||||||
/** Gets the function which is being declared or defined. */
|
/** Gets the function which is being declared or defined. */
|
||||||
Function getFunction() { fun_decls(unresolveElement(this),unresolveElement(result),_,_,_) }
|
Function getFunction() { fun_decls(underlyingElement(this),unresolveElement(result),_,_,_) }
|
||||||
|
|
||||||
/** Gets the name of the function. */
|
/** Gets the name of the function. */
|
||||||
override string getName() { fun_decls(unresolveElement(this),_,_,result,_) }
|
override string getName() { fun_decls(underlyingElement(this),_,_,result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the return type of the function which is being declared or
|
* Gets the return type of the function which is being declared or
|
||||||
* defined.
|
* defined.
|
||||||
*/
|
*/
|
||||||
override Type getType() { fun_decls(unresolveElement(this),_,unresolveElement(result),_,_) }
|
override Type getType() { fun_decls(underlyingElement(this),_,unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/** Gets the location of this declaration entry. */
|
/** Gets the location of this declaration entry. */
|
||||||
override Location getLocation() { fun_decls(unresolveElement(this),_,_,_,result) }
|
override Location getLocation() { fun_decls(underlyingElement(this),_,_,_,result) }
|
||||||
|
|
||||||
/** Gets a specifier associated with this declaration entry. */
|
/** Gets a specifier associated with this declaration entry. */
|
||||||
override string getASpecifier() { fun_decl_specifiers(unresolveElement(this),result) }
|
override string getASpecifier() { fun_decl_specifiers(underlyingElement(this),result) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements `Element.getEnclosingElement`. A function declaration does
|
* Implements `Element.getEnclosingElement`. A function declaration does
|
||||||
@@ -528,7 +528,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* static Foo foo;
|
* static Foo foo;
|
||||||
*/
|
*/
|
||||||
TypedefType getTypedefType() {
|
TypedefType getTypedefType() {
|
||||||
fun_decl_typedef_type(unresolveElement(this),unresolveElement(result))
|
fun_decl_typedef_type(underlyingElement(this),unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -578,7 +578,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* declaration.
|
* declaration.
|
||||||
*/
|
*/
|
||||||
ParameterDeclarationEntry getParameterDeclarationEntry(int n) {
|
ParameterDeclarationEntry getParameterDeclarationEntry(int n) {
|
||||||
param_decl_bind(unresolveElement(result),n,unresolveElement(this))
|
param_decl_bind(unresolveElement(result),n,underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of parameters of this function declaration. */
|
/** Gets the number of parameters of this function declaration. */
|
||||||
@@ -624,12 +624,12 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
|
|
||||||
/** Holds if this declaration is also a definition of its function. */
|
/** Holds if this declaration is also a definition of its function. */
|
||||||
override predicate isDefinition() {
|
override predicate isDefinition() {
|
||||||
fun_def(unresolveElement(this))
|
fun_def(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this declaration is a Template specialization. */
|
/** Holds if this declaration is a Template specialization. */
|
||||||
predicate isSpecialization() {
|
predicate isSpecialization() {
|
||||||
fun_specialized(unresolveElement(this))
|
fun_specialized(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -637,7 +637,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* where a function is used before it is declared (under older C standards).
|
* where a function is used before it is declared (under older C standards).
|
||||||
*/
|
*/
|
||||||
predicate isImplicit() {
|
predicate isImplicit() {
|
||||||
fun_implicit(unresolveElement(this))
|
fun_implicit(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a type that is specified to be thrown by the declared function. */
|
/** Gets a type that is specified to be thrown by the declared function. */
|
||||||
@@ -652,7 +652,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* `int`, and that with index 1 would be `float`.
|
* `int`, and that with index 1 would be `float`.
|
||||||
*/
|
*/
|
||||||
Type getThrownType(int i) {
|
Type getThrownType(int i) {
|
||||||
fun_decl_throws(unresolveElement(this),i,unresolveElement(result))
|
fun_decl_throws(underlyingElement(this),i,unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -660,7 +660,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* this predicate returns the argument to `noexcept` if one was given.
|
* this predicate returns the argument to `noexcept` if one was given.
|
||||||
*/
|
*/
|
||||||
Expr getNoExceptExpr() {
|
Expr getNoExceptExpr() {
|
||||||
fun_decl_noexcept(unresolveElement(this),unresolveElement(result))
|
fun_decl_noexcept(underlyingElement(this),unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -668,8 +668,8 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* 15.4].
|
* 15.4].
|
||||||
*/
|
*/
|
||||||
predicate hasExceptionSpecification() {
|
predicate hasExceptionSpecification() {
|
||||||
fun_decl_throws(unresolveElement(this),_,_) or
|
fun_decl_throws(underlyingElement(this),_,_) or
|
||||||
fun_decl_noexcept(unresolveElement(this),_) or
|
fun_decl_noexcept(underlyingElement(this),_) or
|
||||||
isNoThrow() or
|
isNoThrow() or
|
||||||
isNoExcept()
|
isNoExcept()
|
||||||
}
|
}
|
||||||
@@ -678,7 +678,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* Holds if the declared function has a `throw()` exception specification.
|
* Holds if the declared function has a `throw()` exception specification.
|
||||||
*/
|
*/
|
||||||
predicate isNoThrow() {
|
predicate isNoThrow() {
|
||||||
fun_decl_empty_throws(unresolveElement(this))
|
fun_decl_empty_throws(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -686,7 +686,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
|
|||||||
* specification.
|
* specification.
|
||||||
*/
|
*/
|
||||||
predicate isNoExcept() {
|
predicate isNoExcept() {
|
||||||
fun_decl_empty_noexcept(unresolveElement(this))
|
fun_decl_empty_noexcept(underlyingElement(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ class MemberFunction extends Function {
|
|||||||
predicate isPublic() { this.hasSpecifier("public") }
|
predicate isPublic() { this.hasSpecifier("public") }
|
||||||
|
|
||||||
/** Holds if this function overrides that function. */
|
/** Holds if this function overrides that function. */
|
||||||
predicate overrides(MemberFunction that) { overrides(unresolveElement(this),unresolveElement(that)) }
|
predicate overrides(MemberFunction that) { overrides(underlyingElement(this),unresolveElement(that)) }
|
||||||
|
|
||||||
/** Gets a directly overridden function. */
|
/** Gets a directly overridden function. */
|
||||||
MemberFunction getAnOverriddenFunction() { this.overrides(result) }
|
MemberFunction getAnOverriddenFunction() { this.overrides(result) }
|
||||||
@@ -758,7 +758,7 @@ class MemberFunction extends Function {
|
|||||||
class VirtualFunction extends MemberFunction {
|
class VirtualFunction extends MemberFunction {
|
||||||
|
|
||||||
VirtualFunction() {
|
VirtualFunction() {
|
||||||
this.hasSpecifier("virtual") or purefunctions(unresolveElement(this))
|
this.hasSpecifier("virtual") or purefunctions(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this virtual function is pure. */
|
/** Holds if this virtual function is pure. */
|
||||||
@@ -776,7 +776,7 @@ class VirtualFunction extends MemberFunction {
|
|||||||
*/
|
*/
|
||||||
class PureVirtualFunction extends VirtualFunction {
|
class PureVirtualFunction extends VirtualFunction {
|
||||||
|
|
||||||
PureVirtualFunction() { purefunctions(unresolveElement(this)) }
|
PureVirtualFunction() { purefunctions(underlyingElement(this)) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,7 +796,7 @@ class ConstMemberFunction extends MemberFunction {
|
|||||||
*/
|
*/
|
||||||
class Constructor extends MemberFunction {
|
class Constructor extends MemberFunction {
|
||||||
|
|
||||||
Constructor() { functions(unresolveElement(this),_,2) }
|
Constructor() { functions(underlyingElement(this),_,2) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this constructor serves as a default constructor.
|
* Holds if this constructor serves as a default constructor.
|
||||||
@@ -825,7 +825,7 @@ class Constructor extends MemberFunction {
|
|||||||
* to be evaluated.
|
* to be evaluated.
|
||||||
*/
|
*/
|
||||||
ConstructorInit getInitializer(int i) {
|
ConstructorInit getInitializer(int i) {
|
||||||
exprparents(unresolveElement(result), i, unresolveElement(this))
|
exprparents(unresolveElement(result), i, underlyingElement(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +976,7 @@ class NoArgConstructor extends Constructor {
|
|||||||
* A C++ destructor [N4140 12.4].
|
* A C++ destructor [N4140 12.4].
|
||||||
*/
|
*/
|
||||||
class Destructor extends MemberFunction {
|
class Destructor extends MemberFunction {
|
||||||
Destructor() { functions(unresolveElement(this),_,3) }
|
Destructor() { functions(underlyingElement(this),_,3) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a compiler-generated action which destructs a base class or member
|
* Gets a compiler-generated action which destructs a base class or member
|
||||||
@@ -992,7 +992,7 @@ class Destructor extends MemberFunction {
|
|||||||
* be evaluated.
|
* be evaluated.
|
||||||
*/
|
*/
|
||||||
DestructorDestruction getDestruction(int i) {
|
DestructorDestruction getDestruction(int i) {
|
||||||
exprparents(unresolveElement(result), i, unresolveElement(this))
|
exprparents(unresolveElement(result), i, underlyingElement(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1001,7 +1001,7 @@ class Destructor extends MemberFunction {
|
|||||||
*/
|
*/
|
||||||
class ConversionOperator extends MemberFunction, ImplicitConversionFunction {
|
class ConversionOperator extends MemberFunction, ImplicitConversionFunction {
|
||||||
|
|
||||||
ConversionOperator() { functions(unresolveElement(this),_,4) }
|
ConversionOperator() { functions(underlyingElement(this),_,4) }
|
||||||
|
|
||||||
override Type getSourceType() { result = this.getDeclaringType() }
|
override Type getSourceType() { result = this.getDeclaringType() }
|
||||||
override Type getDestType() { result = this.getType() }
|
override Type getDestType() { result = this.getType() }
|
||||||
@@ -1013,7 +1013,7 @@ class ConversionOperator extends MemberFunction, ImplicitConversionFunction {
|
|||||||
*/
|
*/
|
||||||
class Operator extends Function {
|
class Operator extends Function {
|
||||||
|
|
||||||
Operator() { functions(unresolveElement(this),_,5) }
|
Operator() { functions(underlyingElement(this),_,5) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1074,7 +1074,7 @@ class MoveAssignmentOperator extends Operator {
|
|||||||
* (non-empty) template argument list.
|
* (non-empty) template argument list.
|
||||||
*/
|
*/
|
||||||
class TemplateFunction extends Function {
|
class TemplateFunction extends Function {
|
||||||
TemplateFunction() { is_function_template(unresolveElement(this)) and exists(getATemplateArgument()) }
|
TemplateFunction() { is_function_template(underlyingElement(this)) and exists(getATemplateArgument()) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a compiler-generated instantiation of this function template.
|
* Gets a compiler-generated instantiation of this function template.
|
||||||
@@ -1146,7 +1146,7 @@ class FunctionTemplateSpecialization extends Function {
|
|||||||
*/
|
*/
|
||||||
class BuiltInFunction extends Function {
|
class BuiltInFunction extends Function {
|
||||||
BuiltInFunction() {
|
BuiltInFunction() {
|
||||||
functions(unresolveElement(this),_,6)
|
functions(underlyingElement(this),_,6)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a dummy location for the built-in function. */
|
/** Gets a dummy location for the built-in function. */
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Include extends PreprocessorDirective, @ppd_include {
|
|||||||
string getIncludeText() { result = getHead() }
|
string getIncludeText() { result = getHead() }
|
||||||
|
|
||||||
/** Gets the file directly included by this `#include`. */
|
/** Gets the file directly included by this `#include`. */
|
||||||
File getIncludedFile() { includes(unresolveElement(this), unresolveElement(result)) }
|
File getIncludedFile() { includes(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a file which might be transitively included by this `#include`.
|
* Gets a file which might be transitively included by this `#include`.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import semmle.code.cpp.controlflow.ControlFlowGraph
|
|||||||
* A C/C++ declaration initializer.
|
* A C/C++ declaration initializer.
|
||||||
*/
|
*/
|
||||||
class Initializer extends ControlFlowNode, @initialiser {
|
class Initializer extends ControlFlowNode, @initialiser {
|
||||||
override Location getLocation() { initialisers(unresolveElement(this),_,_,result) }
|
override Location getLocation() { initialisers(underlyingElement(this),_,_,result) }
|
||||||
|
|
||||||
/** Holds if this initializer is explicit in the source. */
|
/** Holds if this initializer is explicit in the source. */
|
||||||
override predicate fromSource() {
|
override predicate fromSource() {
|
||||||
@@ -20,10 +20,10 @@ class Initializer extends ControlFlowNode, @initialiser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the variable or enum constant being initialized. */
|
/** Gets the variable or enum constant being initialized. */
|
||||||
Declaration getDeclaration() { initialisers(unresolveElement(this),unresolveElement(result),_,_) }
|
Declaration getDeclaration() { initialisers(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/** Gets the initializing expression. */
|
/** Gets the initializing expression. */
|
||||||
Expr getExpr() { initialisers(unresolveElement(this),_,unresolveElement(result),_) }
|
Expr getExpr() { initialisers(underlyingElement(this),_,unresolveElement(result),_) }
|
||||||
|
|
||||||
/** Gets the function containing this control-flow node. */
|
/** Gets the function containing this control-flow node. */
|
||||||
override Function getControlFlowScope() {
|
override Function getControlFlowScope() {
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ class Macro extends PreprocessorDirective, @ppd_define {
|
|||||||
* Gets the head of this macro. For example, `MAX(x,y)` in
|
* Gets the head of this macro. For example, `MAX(x,y)` in
|
||||||
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
|
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
|
||||||
*/
|
*/
|
||||||
override string getHead() { preproctext(unresolveElement(this),result,_) }
|
override string getHead() { preproctext(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the body of this macro. For example, `(((x)>(y))?(x):(y))` in
|
* Gets the body of this macro. For example, `(((x)>(y))?(x):(y))` in
|
||||||
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
|
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
|
||||||
*/
|
*/
|
||||||
string getBody() { preproctext(unresolveElement(this),_,result) }
|
string getBody() { preproctext(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
/** Gets an invocation of this macro. */
|
/** Gets an invocation of this macro. */
|
||||||
MacroInvocation getAnInvocation() { result.getMacro() = this }
|
MacroInvocation getAnInvocation() { result.getMacro() = this }
|
||||||
@@ -59,7 +59,7 @@ class Macro extends PreprocessorDirective, @ppd_define {
|
|||||||
*/
|
*/
|
||||||
class MacroAccess extends Locatable, @macroinvocation {
|
class MacroAccess extends Locatable, @macroinvocation {
|
||||||
/** Gets the macro being invoked. */
|
/** Gets the macro being invoked. */
|
||||||
Macro getMacro() { macroinvocations(unresolveElement(this),unresolveElement(result),_,_) }
|
Macro getMacro() { macroinvocations(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the location of the outermost macro access that triggered this macro
|
* Gets the location of the outermost macro access that triggered this macro
|
||||||
@@ -78,7 +78,7 @@ class MacroAccess extends Locatable, @macroinvocation {
|
|||||||
* a `#define` directive or inside an argument to another macro.
|
* a `#define` directive or inside an argument to another macro.
|
||||||
*/
|
*/
|
||||||
Location getActualLocation() {
|
Location getActualLocation() {
|
||||||
macroinvocations(unresolveElement(this),_,result,_)
|
macroinvocations(underlyingElement(this),_,result,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +111,7 @@ class MacroAccess extends Locatable, @macroinvocation {
|
|||||||
* There is only a single invocation even though `c` occurs twice; this is an
|
* There is only a single invocation even though `c` occurs twice; this is an
|
||||||
* optimization for efficiency.
|
* optimization for efficiency.
|
||||||
*/
|
*/
|
||||||
MacroInvocation getParentInvocation() { macroparent(unresolveElement(this),unresolveElement(result)) }
|
MacroInvocation getParentInvocation() { macroparent(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the outermost `MacroAccess` along the chain of `getParentInvocation`.
|
* Gets the outermost `MacroAccess` along the chain of `getParentInvocation`.
|
||||||
@@ -137,14 +137,14 @@ class MacroAccess extends Locatable, @macroinvocation {
|
|||||||
*/
|
*/
|
||||||
class MacroInvocation extends MacroAccess {
|
class MacroInvocation extends MacroAccess {
|
||||||
MacroInvocation() {
|
MacroInvocation() {
|
||||||
macroinvocations(unresolveElement(this),_,_,1)
|
macroinvocations(underlyingElement(this),_,_,1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an element that occurs in this macro invocation or a nested macro
|
* Gets an element that occurs in this macro invocation or a nested macro
|
||||||
* invocation.
|
* invocation.
|
||||||
*/
|
*/
|
||||||
Locatable getAnExpandedElement() { inmacroexpansion(unresolveElement(result),unresolveElement(this)) }
|
Locatable getAnExpandedElement() { inmacroexpansion(unresolveElement(result),underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an element that is (partially) affected by a macro
|
* Gets an element that is (partially) affected by a macro
|
||||||
@@ -153,7 +153,7 @@ class MacroInvocation extends MacroAccess {
|
|||||||
* well.
|
* well.
|
||||||
*/
|
*/
|
||||||
Locatable getAnAffectedElement() {
|
Locatable getAnAffectedElement() {
|
||||||
inmacroexpansion(unresolveElement(result),unresolveElement(this)) or macrolocationbind(unresolveElement(this), result.getLocation())
|
inmacroexpansion(unresolveElement(result),underlyingElement(this)) or macrolocationbind(underlyingElement(this), result.getLocation())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -224,7 +224,7 @@ class MacroInvocation extends MacroAccess {
|
|||||||
* Use `getExpandedArgument` to get the expanded form.
|
* Use `getExpandedArgument` to get the expanded form.
|
||||||
*/
|
*/
|
||||||
string getUnexpandedArgument(int i) {
|
string getUnexpandedArgument(int i) {
|
||||||
macro_argument_unexpanded(unresolveElement(this), i, result)
|
macro_argument_unexpanded(underlyingElement(this), i, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,7 +238,7 @@ class MacroInvocation extends MacroAccess {
|
|||||||
* differences between expanded and unexpanded arguments.
|
* differences between expanded and unexpanded arguments.
|
||||||
*/
|
*/
|
||||||
string getExpandedArgument(int i) {
|
string getExpandedArgument(int i) {
|
||||||
macro_argument_expanded(unresolveElement(this), i, result)
|
macro_argument_expanded(underlyingElement(this), i, result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
|
|
||||||
/** Gets a location for this name qualifier. */
|
/** Gets a location for this name qualifier. */
|
||||||
override Location getLocation() {
|
override Location getLocation() {
|
||||||
namequalifiers(unresolveElement(this),_,_,result)
|
namequalifiers(underlyingElement(this),_,_,result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,7 +23,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
* `N2::` has a name qualifier `N1::` in the chain `N1::N2::f()`.
|
* `N2::` has a name qualifier `N1::` in the chain `N1::N2::f()`.
|
||||||
*/
|
*/
|
||||||
override NameQualifier getNameQualifier() {
|
override NameQualifier getNameQualifier() {
|
||||||
namequalifiers(unresolveElement(result),unresolveElement(this),_,_)
|
namequalifiers(unresolveElement(result),underlyingElement(this),_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +31,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
* in `N::f()`.
|
* in `N::f()`.
|
||||||
*/
|
*/
|
||||||
NameQualifiableElement getQualifiedElement() {
|
NameQualifiableElement getQualifiedElement() {
|
||||||
namequalifiers(unresolveElement(this),unresolveElement(result),_,_)
|
namequalifiers(underlyingElement(this),unresolveElement(result),_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +40,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
*/
|
*/
|
||||||
NameQualifyingElement getQualifyingElement() {
|
NameQualifyingElement getQualifyingElement() {
|
||||||
exists (NameQualifyingElement nqe
|
exists (NameQualifyingElement nqe
|
||||||
| namequalifiers(unresolveElement(this),_,unresolveElement(nqe),_) and
|
| namequalifiers(underlyingElement(this),_,unresolveElement(nqe),_) and
|
||||||
if nqe instanceof SpecialNameQualifyingElement
|
if nqe instanceof SpecialNameQualifyingElement
|
||||||
then (exists (Access a
|
then (exists (Access a
|
||||||
| a = getQualifiedElement() and
|
| a = getQualifiedElement() and
|
||||||
@@ -54,7 +54,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
exists (NameQualifyingElement nqe
|
exists (NameQualifyingElement nqe
|
||||||
| namequalifiers(unresolveElement(this),_,unresolveElement(nqe),_)
|
| namequalifiers(underlyingElement(this),_,unresolveElement(nqe),_)
|
||||||
and result = nqe.getName() + "::")
|
and result = nqe.getName() + "::")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class NameQualifier extends NameQualifiableElement, @namequalifier {
|
|||||||
class NameQualifiableElement extends Element, @namequalifiableelement {
|
class NameQualifiableElement extends Element, @namequalifiableelement {
|
||||||
/** Gets the name qualifier associated with this element. */
|
/** Gets the name qualifier associated with this element. */
|
||||||
NameQualifier getNameQualifier() {
|
NameQualifier getNameQualifier() {
|
||||||
namequalifiers(unresolveElement(result),unresolveElement(this),_,_)
|
namequalifiers(unresolveElement(result),underlyingElement(this),_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +106,7 @@ class NameQualifyingElement extends Element, @namequalifyingelement {
|
|||||||
* `NameQualifyingElement` and `X::` is the `NameQualifier`.
|
* `NameQualifyingElement` and `X::` is the `NameQualifier`.
|
||||||
*/
|
*/
|
||||||
NameQualifier getANameQualifier() {
|
NameQualifier getANameQualifier() {
|
||||||
namequalifiers(unresolveElement(result),_,unresolveElement(this),_)
|
namequalifiers(unresolveElement(result),_,underlyingElement(this),_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the name of this namespace or user-defined type. */
|
/** Gets the name of this namespace or user-defined type. */
|
||||||
@@ -121,6 +121,6 @@ class NameQualifyingElement extends Element, @namequalifyingelement {
|
|||||||
library class SpecialNameQualifyingElement extends NameQualifyingElement, @specialnamequalifyingelement {
|
library class SpecialNameQualifyingElement extends NameQualifyingElement, @specialnamequalifyingelement {
|
||||||
/** Gets the name of this special qualifying element. */
|
/** Gets the name of this special qualifying element. */
|
||||||
override string getName() {
|
override string getName() {
|
||||||
specialnamequalifyingelements(unresolveElement(this),result)
|
specialnamequalifyingelements(underlyingElement(this),result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Namespace extends NameQualifyingElement, @namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the simple name of this namespace. */
|
/** Gets the simple name of this namespace. */
|
||||||
override string getName() { namespaces(unresolveElement(this),result) }
|
override string getName() { namespaces(underlyingElement(this),result) }
|
||||||
|
|
||||||
/** Holds if this element is named `name`. */
|
/** Holds if this element is named `name`. */
|
||||||
predicate hasName(string name) { name = this.getName() }
|
predicate hasName(string name) { name = this.getName() }
|
||||||
@@ -56,15 +56,15 @@ class Namespace extends NameQualifyingElement, @namespace {
|
|||||||
|
|
||||||
/** Gets the parent namespace, if any. */
|
/** Gets the parent namespace, if any. */
|
||||||
Namespace getParentNamespace() {
|
Namespace getParentNamespace() {
|
||||||
namespacembrs(unresolveElement(result),unresolveElement(this)) or
|
namespacembrs(unresolveElement(result),underlyingElement(this)) or
|
||||||
(not namespacembrs(_, unresolveElement(this)) and result instanceof GlobalNamespace)
|
(not namespacembrs(_, underlyingElement(this)) and result instanceof GlobalNamespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a child declaration of this namespace. */
|
/** Gets a child declaration of this namespace. */
|
||||||
Declaration getADeclaration() { namespacembrs(unresolveElement(this),unresolveElement(result)) }
|
Declaration getADeclaration() { namespacembrs(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets a child namespace of this namespace. */
|
/** Gets a child namespace of this namespace. */
|
||||||
Namespace getAChildNamespace() { namespacembrs(unresolveElement(this),unresolveElement(result)) }
|
Namespace getAChildNamespace() { namespacembrs(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Holds if this namespace may be from source. */
|
/** Holds if this namespace may be from source. */
|
||||||
override predicate fromSource() { this.getADeclaration().fromSource() }
|
override predicate fromSource() { this.getADeclaration().fromSource() }
|
||||||
@@ -106,7 +106,7 @@ class NamespaceDeclarationEntry extends Locatable, @namespace_decl {
|
|||||||
* is a one-to-many relationship between `Namespace` and
|
* is a one-to-many relationship between `Namespace` and
|
||||||
* `NamespaceDeclarationEntry`.
|
* `NamespaceDeclarationEntry`.
|
||||||
*/
|
*/
|
||||||
Namespace getNamespace() { namespace_decls(unresolveElement(this),unresolveElement(result),_,_) }
|
Namespace getNamespace() { namespace_decls(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
override string toString() { result = this.getNamespace().toString() }
|
override string toString() { result = this.getNamespace().toString() }
|
||||||
|
|
||||||
@@ -120,20 +120,20 @@ class NamespaceDeclarationEntry extends Locatable, @namespace_decl {
|
|||||||
* For anonymous declarations, such as "namespace { ... }", this will
|
* For anonymous declarations, such as "namespace { ... }", this will
|
||||||
* give the "namespace" token.
|
* give the "namespace" token.
|
||||||
*/
|
*/
|
||||||
override Location getLocation() { namespace_decls(unresolveElement(this),_,result,_) }
|
override Location getLocation() { namespace_decls(underlyingElement(this),_,result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the location of the namespace declaration entry's body. For
|
* Gets the location of the namespace declaration entry's body. For
|
||||||
* example: the "{ ... }" in "namespace N { ... }".
|
* example: the "{ ... }" in "namespace N { ... }".
|
||||||
*/
|
*/
|
||||||
Location getBodyLocation() { namespace_decls(unresolveElement(this),_,_,result) }
|
Location getBodyLocation() { namespace_decls(underlyingElement(this),_,_,result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C++ `using` directive or `using` declaration.
|
* A C++ `using` directive or `using` declaration.
|
||||||
*/
|
*/
|
||||||
abstract class UsingEntry extends Locatable, @using {
|
abstract class UsingEntry extends Locatable, @using {
|
||||||
override Location getLocation() { usings(unresolveElement(this),_,result) }
|
override Location getLocation() { usings(underlyingElement(this),_,result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,13 +142,13 @@ abstract class UsingEntry extends Locatable, @using {
|
|||||||
* `using std::string;`
|
* `using std::string;`
|
||||||
*/
|
*/
|
||||||
class UsingDeclarationEntry extends UsingEntry {
|
class UsingDeclarationEntry extends UsingEntry {
|
||||||
UsingDeclarationEntry() { not exists(Namespace n | usings(unresolveElement(this),unresolveElement(n),_)) }
|
UsingDeclarationEntry() { not exists(Namespace n | usings(underlyingElement(this),unresolveElement(n),_)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the declaration that is referenced by this using declaration. For
|
* Gets the declaration that is referenced by this using declaration. For
|
||||||
* example, `std::string` in `using std::string`.
|
* example, `std::string` in `using std::string`.
|
||||||
*/
|
*/
|
||||||
Declaration getDeclaration() { usings(unresolveElement(this),unresolveElement(result),_) }
|
Declaration getDeclaration() { usings(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
result = "using " + this.getDeclaration().toString()
|
result = "using " + this.getDeclaration().toString()
|
||||||
@@ -161,13 +161,13 @@ class UsingDeclarationEntry extends UsingEntry {
|
|||||||
* `using namespace std;`
|
* `using namespace std;`
|
||||||
*/
|
*/
|
||||||
class UsingDirectiveEntry extends UsingEntry {
|
class UsingDirectiveEntry extends UsingEntry {
|
||||||
UsingDirectiveEntry() { exists(Namespace n | usings(unresolveElement(this),unresolveElement(n),_)) }
|
UsingDirectiveEntry() { exists(Namespace n | usings(underlyingElement(this),unresolveElement(n),_)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the namespace that is referenced by this using directive. For
|
* Gets the namespace that is referenced by this using directive. For
|
||||||
* example, `std` in `using namespace std`.
|
* example, `std` in `using namespace std`.
|
||||||
*/
|
*/
|
||||||
Namespace getNamespace() { usings(unresolveElement(this),unresolveElement(result),_) }
|
Namespace getNamespace() { usings(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
result = "using namespace " + this.getNamespace().toString()
|
result = "using namespace " + this.getNamespace().toString()
|
||||||
|
|||||||
@@ -102,20 +102,20 @@ class Parameter extends LocalScopeVariable, @parameter {
|
|||||||
* Gets the function to which this parameter belongs, if it is a function
|
* Gets the function to which this parameter belongs, if it is a function
|
||||||
* parameter.
|
* parameter.
|
||||||
*/
|
*/
|
||||||
override Function getFunction() { params(unresolveElement(this),unresolveElement(result),_,_) }
|
override Function getFunction() { params(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the catch block to which this parameter belongs, if it is a catch
|
* Gets the catch block to which this parameter belongs, if it is a catch
|
||||||
* block parameter.
|
* block parameter.
|
||||||
*/
|
*/
|
||||||
Block getCatchBlock() { params(unresolveElement(this),unresolveElement(result),_,_) }
|
Block getCatchBlock() { params(underlyingElement(this),unresolveElement(result),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the zero-based index of this parameter.
|
* Gets the zero-based index of this parameter.
|
||||||
*
|
*
|
||||||
* For catch block parameters, this is always zero.
|
* For catch block parameters, this is always zero.
|
||||||
*/
|
*/
|
||||||
int getIndex() { params(unresolveElement(this),_,result,_) }
|
int getIndex() { params(underlyingElement(this),_,result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of this parameter.
|
* Gets the type of this parameter.
|
||||||
@@ -124,7 +124,7 @@ class Parameter extends LocalScopeVariable, @parameter {
|
|||||||
* as they are syntactic sugar for parameters of pointer type. The
|
* as they are syntactic sugar for parameters of pointer type. The
|
||||||
* result is an array type for such parameters.
|
* result is an array type for such parameters.
|
||||||
*/
|
*/
|
||||||
override Type getType() { params(unresolveElement(this),_,_,unresolveElement(result)) }
|
override Type getType() { params(underlyingElement(this),_,_,unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the canonical location, or locations, of this parameter.
|
* Gets the canonical location, or locations, of this parameter.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import semmle.code.cpp.Element
|
|||||||
*/
|
*/
|
||||||
class PreprocessorDirective extends Locatable, @preprocdirect {
|
class PreprocessorDirective extends Locatable, @preprocdirect {
|
||||||
override string toString() { result = "Preprocessor directive" }
|
override string toString() { result = "Preprocessor directive" }
|
||||||
override Location getLocation() { preprocdirects(unresolveElement(this),_,result) }
|
override Location getLocation() { preprocdirects(underlyingElement(this),_,result) }
|
||||||
string getHead() { preproctext(unresolveElement(this),result,_) }
|
string getHead() { preproctext(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a preprocessor branching directive whose condition affects
|
* Gets a preprocessor branching directive whose condition affects
|
||||||
@@ -49,7 +49,7 @@ abstract class PreprocessorBranchDirective extends PreprocessorDirective {
|
|||||||
result = (PreprocessorIf)this or
|
result = (PreprocessorIf)this or
|
||||||
result = (PreprocessorIfdef)this or
|
result = (PreprocessorIfdef)this or
|
||||||
result = (PreprocessorIfndef)this or
|
result = (PreprocessorIfndef)this or
|
||||||
preprocpair(unresolveElement(result), unresolveElement(this))
|
preprocpair(unresolveElement(result), underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +106,7 @@ class PreprocessorBranch extends PreprocessorBranchDirective, @ppd_branch {
|
|||||||
* condition and subsequently took the branch.
|
* condition and subsequently took the branch.
|
||||||
*/
|
*/
|
||||||
predicate wasTaken() {
|
predicate wasTaken() {
|
||||||
preproctrue(unresolveElement(this))
|
preproctrue(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +117,7 @@ class PreprocessorBranch extends PreprocessorBranchDirective, @ppd_branch {
|
|||||||
* `#else` was taken instead.
|
* `#else` was taken instead.
|
||||||
*/
|
*/
|
||||||
predicate wasNotTaken() {
|
predicate wasNotTaken() {
|
||||||
preprocfalse(unresolveElement(this))
|
preprocfalse(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Specifier extends Element, @specifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the name of this specifier. */
|
/** Gets the name of this specifier. */
|
||||||
string getName() { specifiers(unresolveElement(this),result) }
|
string getName() { specifiers(underlyingElement(this),result) }
|
||||||
|
|
||||||
/** Holds if the name of this specifier is `name`. */
|
/** Holds if the name of this specifier is `name`. */
|
||||||
predicate hasName(string name) { name = this.getName() }
|
predicate hasName(string name) { name = this.getName() }
|
||||||
@@ -114,9 +114,9 @@ class Attribute extends Element, @attribute {
|
|||||||
* Note that the name does not include the namespace. For example, the
|
* Note that the name does not include the namespace. For example, the
|
||||||
* name of `[[clang::fallthrough]]` is "fallthrough".
|
* name of `[[clang::fallthrough]]` is "fallthrough".
|
||||||
*/
|
*/
|
||||||
string getName() { attributes(unresolveElement(this), _, result, _, _) }
|
string getName() { attributes(underlyingElement(this), _, result, _, _) }
|
||||||
|
|
||||||
override Location getLocation() { attributes(unresolveElement(this), _, _, _, result) }
|
override Location getLocation() { attributes(underlyingElement(this), _, _, _, result) }
|
||||||
|
|
||||||
/** Holds if the name of this attribute is `name`. */
|
/** Holds if the name of this attribute is `name`. */
|
||||||
predicate hasName(string name) { name = this.getName() }
|
predicate hasName(string name) { name = this.getName() }
|
||||||
@@ -152,7 +152,7 @@ class StdAttribute extends Attribute, @stdattribute {
|
|||||||
* As examples, this is "" for `[[carries_dependency]]`, and "clang" for
|
* As examples, this is "" for `[[carries_dependency]]`, and "clang" for
|
||||||
* `[[clang::fallthrough]]`.
|
* `[[clang::fallthrough]]`.
|
||||||
*/
|
*/
|
||||||
string getNamespace() { attributes(unresolveElement(this), _, _, result, _) }
|
string getNamespace() { attributes(underlyingElement(this), _, _, result, _) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this attribute has the given namespace and name.
|
* Holds if this attribute has the given namespace and name.
|
||||||
@@ -249,7 +249,7 @@ class AttributeArgument extends Element, @attribute_arg {
|
|||||||
* have a named argument.
|
* have a named argument.
|
||||||
*/
|
*/
|
||||||
string getName() {
|
string getName() {
|
||||||
attribute_arg_name(unresolveElement(this), result)
|
attribute_arg_name(underlyingElement(this), result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,7 +257,7 @@ class AttributeArgument extends Element, @attribute_arg {
|
|||||||
* a string or a number.
|
* a string or a number.
|
||||||
*/
|
*/
|
||||||
string getValueText() {
|
string getValueText() {
|
||||||
attribute_arg_value(unresolveElement(this), result)
|
attribute_arg_value(underlyingElement(this), result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,14 +271,14 @@ class AttributeArgument extends Element, @attribute_arg {
|
|||||||
* Gets the value of this argument, if its value is a type.
|
* Gets the value of this argument, if its value is a type.
|
||||||
*/
|
*/
|
||||||
Type getValueType() {
|
Type getValueType() {
|
||||||
attribute_arg_type(unresolveElement(this), unresolveElement(result))
|
attribute_arg_type(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the attribute to which this is an argument.
|
* Gets the attribute to which this is an argument.
|
||||||
*/
|
*/
|
||||||
Attribute getAttribute() {
|
Attribute getAttribute() {
|
||||||
attribute_args(unresolveElement(this), _, unresolveElement(result), _, _)
|
attribute_args(underlyingElement(this), _, unresolveElement(result), _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -286,11 +286,11 @@ class AttributeArgument extends Element, @attribute_arg {
|
|||||||
* attribute's argument list.
|
* attribute's argument list.
|
||||||
*/
|
*/
|
||||||
int getIndex() {
|
int getIndex() {
|
||||||
attribute_args(unresolveElement(this), _, _, result, _)
|
attribute_args(underlyingElement(this), _, _, result, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override Location getLocation() {
|
override Location getLocation() {
|
||||||
attribute_args(unresolveElement(this), _, _, _, result)
|
attribute_args(underlyingElement(this), _, _, _, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import semmle.code.cpp.Class
|
|||||||
*/
|
*/
|
||||||
class Struct extends Class {
|
class Struct extends Class {
|
||||||
|
|
||||||
Struct() { usertypes(unresolveElement(this),_,1) or usertypes(unresolveElement(this),_,3) }
|
Struct() { usertypes(underlyingElement(this),_,1) or usertypes(underlyingElement(this),_,3) }
|
||||||
|
|
||||||
override string explain() { result = "struct " + this.getName() }
|
override string explain() { result = "struct " + this.getName() }
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Type extends Locatable, @type {
|
|||||||
// inherits from both Type and Declaration and must override it to resolve
|
// inherits from both Type and Declaration and must override it to resolve
|
||||||
// the ambiguity.
|
// the ambiguity.
|
||||||
Specifier getASpecifier() {
|
Specifier getASpecifier() {
|
||||||
typespecifiers(unresolveElement(this),unresolveElement(result))
|
typespecifiers(underlyingElement(this),unresolveElement(result))
|
||||||
or
|
or
|
||||||
result = this.internal_getAnAdditionalSpecifier()
|
result = this.internal_getAnAdditionalSpecifier()
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ class Type extends Locatable, @type {
|
|||||||
/**
|
/**
|
||||||
* Gets an attribute of this type.
|
* Gets an attribute of this type.
|
||||||
*/
|
*/
|
||||||
Attribute getAnAttribute() { typeattributes(unresolveElement(this),unresolveElement(result)) }
|
Attribute getAnAttribute() { typeattributes(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal -- should be `protected` when QL supports such a flag. Subtypes
|
* Internal -- should be `protected` when QL supports such a flag. Subtypes
|
||||||
@@ -98,7 +98,7 @@ class Type extends Locatable, @type {
|
|||||||
*
|
*
|
||||||
* For example, starting with `const i64* const` in the context of `typedef long long i64;`, this predicate will return `long long*`.
|
* For example, starting with `const i64* const` in the context of `typedef long long i64;`, this predicate will return `long long*`.
|
||||||
*/
|
*/
|
||||||
Type getUnspecifiedType() { unspecifiedtype(unresolveElement(this), unresolveElement(result)) }
|
Type getUnspecifiedType() { unspecifiedtype(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets this type after any top-level specifiers and typedefs have been stripped.
|
* Gets this type after any top-level specifiers and typedefs have been stripped.
|
||||||
@@ -111,18 +111,18 @@ class Type extends Locatable, @type {
|
|||||||
* Gets the size of this type in bytes.
|
* Gets the size of this type in bytes.
|
||||||
*/
|
*/
|
||||||
int getSize() {
|
int getSize() {
|
||||||
builtintypes(unresolveElement(this), _, _, result, _, _)
|
builtintypes(underlyingElement(this), _, _, result, _, _)
|
||||||
or pointerishsize(unresolveElement(this), result, _)
|
or pointerishsize(underlyingElement(this), result, _)
|
||||||
or usertypesize(unresolveElement(this), result, _)
|
or usertypesize(underlyingElement(this), result, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the alignment of this type in bytes.
|
* Gets the alignment of this type in bytes.
|
||||||
*/
|
*/
|
||||||
int getAlignment() {
|
int getAlignment() {
|
||||||
builtintypes(unresolveElement(this), _, _, _, _, result)
|
builtintypes(underlyingElement(this), _, _, _, _, result)
|
||||||
or pointerishsize(unresolveElement(this), _, result)
|
or pointerishsize(underlyingElement(this), _, result)
|
||||||
or usertypesize(unresolveElement(this), _, result)
|
or usertypesize(underlyingElement(this), _, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,7 +306,7 @@ class Type extends Locatable, @type {
|
|||||||
class BuiltInType extends Type, @builtintype {
|
class BuiltInType extends Type, @builtintype {
|
||||||
override string toString() { result = this.getName() }
|
override string toString() { result = this.getName() }
|
||||||
|
|
||||||
override string getName() { builtintypes(unresolveElement(this),result,_,_,_,_) }
|
override string getName() { builtintypes(underlyingElement(this),result,_,_,_,_) }
|
||||||
|
|
||||||
override string explain() { result = this.getName() }
|
override string explain() { result = this.getName() }
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ class BuiltInType extends Type, @builtintype {
|
|||||||
*/
|
*/
|
||||||
class ErroneousType extends BuiltInType {
|
class ErroneousType extends BuiltInType {
|
||||||
|
|
||||||
ErroneousType() { builtintypes(unresolveElement(this),_,1,_,_,_) }
|
ErroneousType() { builtintypes(underlyingElement(this),_,1,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ class ErroneousType extends BuiltInType {
|
|||||||
*/
|
*/
|
||||||
class UnknownType extends BuiltInType {
|
class UnknownType extends BuiltInType {
|
||||||
|
|
||||||
UnknownType() { builtintypes(unresolveElement(this),_,2,_,_,_) }
|
UnknownType() { builtintypes(underlyingElement(this),_,2,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ private predicate isArithmeticType(@builtintype type, int kind) {
|
|||||||
*/
|
*/
|
||||||
class ArithmeticType extends BuiltInType {
|
class ArithmeticType extends BuiltInType {
|
||||||
ArithmeticType() {
|
ArithmeticType() {
|
||||||
isArithmeticType(unresolveElement(this), _)
|
isArithmeticType(underlyingElement(this), _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,14 +357,14 @@ class IntegralOrEnumType extends Type {
|
|||||||
IntegralOrEnumType() {
|
IntegralOrEnumType() {
|
||||||
// Integral type
|
// Integral type
|
||||||
exists(int kind |
|
exists(int kind |
|
||||||
isArithmeticType(unresolveElement(this), kind) and
|
isArithmeticType(underlyingElement(this), kind) and
|
||||||
(kind < 24 or kind = 33 or (35 <= kind and kind <= 37) or
|
(kind < 24 or kind = 33 or (35 <= kind and kind <= 37) or
|
||||||
kind = 43 or kind = 44)
|
kind = 43 or kind = 44)
|
||||||
) or
|
) or
|
||||||
// Enum type
|
// Enum type
|
||||||
(
|
(
|
||||||
usertypes(unresolveElement(this), _, 4) or
|
usertypes(underlyingElement(this), _, 4) or
|
||||||
usertypes(unresolveElement(this), _, 13)
|
usertypes(underlyingElement(this), _, 13)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,33 +375,33 @@ class IntegralOrEnumType extends Type {
|
|||||||
class IntegralType extends ArithmeticType, IntegralOrEnumType {
|
class IntegralType extends ArithmeticType, IntegralOrEnumType {
|
||||||
/** Holds if this integral type is signed. */
|
/** Holds if this integral type is signed. */
|
||||||
predicate isSigned() {
|
predicate isSigned() {
|
||||||
builtintypes(unresolveElement(this),_,_,_,-1,_)
|
builtintypes(underlyingElement(this),_,_,_,-1,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this integral type is unsigned. */
|
/** Holds if this integral type is unsigned. */
|
||||||
predicate isUnsigned() {
|
predicate isUnsigned() {
|
||||||
builtintypes(unresolveElement(this),_,_,_,1,_)
|
builtintypes(underlyingElement(this),_,_,_,1,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this integral type is explicitly signed. */
|
/** Holds if this integral type is explicitly signed. */
|
||||||
predicate isExplicitlySigned() {
|
predicate isExplicitlySigned() {
|
||||||
builtintypes(unresolveElement(this),_,7,_,_,_) or builtintypes(unresolveElement(this),_,10,_,_,_) or builtintypes(unresolveElement(this),_,13,_,_,_) or
|
builtintypes(underlyingElement(this),_,7,_,_,_) or builtintypes(underlyingElement(this),_,10,_,_,_) or builtintypes(underlyingElement(this),_,13,_,_,_) or
|
||||||
builtintypes(unresolveElement(this),_,16,_,_,_) or builtintypes(unresolveElement(this),_,19,_,_,_) or
|
builtintypes(underlyingElement(this),_,16,_,_,_) or builtintypes(underlyingElement(this),_,19,_,_,_) or
|
||||||
builtintypes(unresolveElement(this),_,37,_,_,_)
|
builtintypes(underlyingElement(this),_,37,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this integral type is explicitly unsigned. */
|
/** Holds if this integral type is explicitly unsigned. */
|
||||||
predicate isExplicitlyUnsigned() {
|
predicate isExplicitlyUnsigned() {
|
||||||
builtintypes(unresolveElement(this),_,6,_,_,_) or builtintypes(unresolveElement(this),_,9,_,_,_) or builtintypes(unresolveElement(this),_,12,_,_,_) or
|
builtintypes(underlyingElement(this),_,6,_,_,_) or builtintypes(underlyingElement(this),_,9,_,_,_) or builtintypes(underlyingElement(this),_,12,_,_,_) or
|
||||||
builtintypes(unresolveElement(this),_,15,_,_,_) or builtintypes(unresolveElement(this),_,18,_,_,_) or
|
builtintypes(underlyingElement(this),_,15,_,_,_) or builtintypes(underlyingElement(this),_,18,_,_,_) or
|
||||||
builtintypes(unresolveElement(this),_,36,_,_,_)
|
builtintypes(underlyingElement(this),_,36,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this integral type is implicitly signed. */
|
/** Holds if this integral type is implicitly signed. */
|
||||||
predicate isImplicitlySigned() {
|
predicate isImplicitlySigned() {
|
||||||
builtintypes(unresolveElement(this),_,5,_,-1,_) or builtintypes(unresolveElement(this),_,8,_,-1,_) or builtintypes(unresolveElement(this),_,11,_,-1,_) or
|
builtintypes(underlyingElement(this),_,5,_,-1,_) or builtintypes(underlyingElement(this),_,8,_,-1,_) or builtintypes(underlyingElement(this),_,11,_,-1,_) or
|
||||||
builtintypes(unresolveElement(this),_,14,_,-1,_) or builtintypes(unresolveElement(this),_,17,_,-1,_) or
|
builtintypes(underlyingElement(this),_,14,_,-1,_) or builtintypes(underlyingElement(this),_,17,_,-1,_) or
|
||||||
builtintypes(unresolveElement(this),_,35,_,-1,_)
|
builtintypes(underlyingElement(this),_,35,_,-1,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -409,12 +409,12 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
|
|||||||
* example on a `short`, this would give the type `unsigned short`.
|
* example on a `short`, this would give the type `unsigned short`.
|
||||||
*/
|
*/
|
||||||
IntegralType getUnsigned() {
|
IntegralType getUnsigned() {
|
||||||
(builtintypes(unresolveElement(this),_, 5,_,_,_) or builtintypes(unresolveElement(this),_, 6,_,_,_) or builtintypes(unresolveElement(this),_, 7,_,_,_)) and builtintypes(unresolveElement(result),_, 6,_,_,_)
|
(builtintypes(underlyingElement(this),_, 5,_,_,_) or builtintypes(underlyingElement(this),_, 6,_,_,_) or builtintypes(underlyingElement(this),_, 7,_,_,_)) and builtintypes(unresolveElement(result),_, 6,_,_,_)
|
||||||
or (builtintypes(unresolveElement(this),_, 8,_,_,_) or builtintypes(unresolveElement(this),_, 9,_,_,_) or builtintypes(unresolveElement(this),_,10,_,_,_)) and builtintypes(unresolveElement(result),_, 9,_,_,_)
|
or (builtintypes(underlyingElement(this),_, 8,_,_,_) or builtintypes(underlyingElement(this),_, 9,_,_,_) or builtintypes(underlyingElement(this),_,10,_,_,_)) and builtintypes(unresolveElement(result),_, 9,_,_,_)
|
||||||
or (builtintypes(unresolveElement(this),_,11,_,_,_) or builtintypes(unresolveElement(this),_,12,_,_,_) or builtintypes(unresolveElement(this),_,13,_,_,_)) and builtintypes(unresolveElement(result),_,12,_,_,_)
|
or (builtintypes(underlyingElement(this),_,11,_,_,_) or builtintypes(underlyingElement(this),_,12,_,_,_) or builtintypes(underlyingElement(this),_,13,_,_,_)) and builtintypes(unresolveElement(result),_,12,_,_,_)
|
||||||
or (builtintypes(unresolveElement(this),_,14,_,_,_) or builtintypes(unresolveElement(this),_,15,_,_,_) or builtintypes(unresolveElement(this),_,16,_,_,_)) and builtintypes(unresolveElement(result),_,15,_,_,_)
|
or (builtintypes(underlyingElement(this),_,14,_,_,_) or builtintypes(underlyingElement(this),_,15,_,_,_) or builtintypes(underlyingElement(this),_,16,_,_,_)) and builtintypes(unresolveElement(result),_,15,_,_,_)
|
||||||
or (builtintypes(unresolveElement(this),_,17,_,_,_) or builtintypes(unresolveElement(this),_,18,_,_,_) or builtintypes(unresolveElement(this),_,19,_,_,_)) and builtintypes(unresolveElement(result),_,18,_,_,_)
|
or (builtintypes(underlyingElement(this),_,17,_,_,_) or builtintypes(underlyingElement(this),_,18,_,_,_) or builtintypes(underlyingElement(this),_,19,_,_,_)) and builtintypes(unresolveElement(result),_,18,_,_,_)
|
||||||
or (builtintypes(unresolveElement(this),_,35,_,_,_) or builtintypes(unresolveElement(this),_,36,_,_,_) or builtintypes(unresolveElement(this),_,37,_,_,_)) and builtintypes(unresolveElement(result),_,36,_,_,_)
|
or (builtintypes(underlyingElement(this),_,35,_,_,_) or builtintypes(underlyingElement(this),_,36,_,_,_) or builtintypes(underlyingElement(this),_,37,_,_,_)) and builtintypes(unresolveElement(result),_,36,_,_,_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
|
|||||||
*/
|
*/
|
||||||
class BoolType extends IntegralType {
|
class BoolType extends IntegralType {
|
||||||
|
|
||||||
BoolType() { builtintypes(unresolveElement(this),_,4,_,_,_) }
|
BoolType() { builtintypes(underlyingElement(this),_,4,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ abstract class CharType extends IntegralType { }
|
|||||||
*/
|
*/
|
||||||
class PlainCharType extends CharType {
|
class PlainCharType extends CharType {
|
||||||
PlainCharType() {
|
PlainCharType() {
|
||||||
builtintypes(unresolveElement(this),_,5,_,_,_)
|
builtintypes(underlyingElement(this),_,5,_,_,_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ class PlainCharType extends CharType {
|
|||||||
*/
|
*/
|
||||||
class UnsignedCharType extends CharType {
|
class UnsignedCharType extends CharType {
|
||||||
UnsignedCharType() {
|
UnsignedCharType() {
|
||||||
builtintypes(unresolveElement(this),_,6,_,_,_)
|
builtintypes(underlyingElement(this),_,6,_,_,_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ class UnsignedCharType extends CharType {
|
|||||||
*/
|
*/
|
||||||
class SignedCharType extends CharType {
|
class SignedCharType extends CharType {
|
||||||
SignedCharType() {
|
SignedCharType() {
|
||||||
builtintypes(unresolveElement(this),_,7,_,_,_)
|
builtintypes(underlyingElement(this),_,7,_,_,_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ class SignedCharType extends CharType {
|
|||||||
class ShortType extends IntegralType {
|
class ShortType extends IntegralType {
|
||||||
|
|
||||||
ShortType() {
|
ShortType() {
|
||||||
builtintypes(unresolveElement(this),_,8,_,_,_) or builtintypes(unresolveElement(this),_,9,_,_,_) or builtintypes(unresolveElement(this),_,10,_,_,_)
|
builtintypes(underlyingElement(this),_,8,_,_,_) or builtintypes(underlyingElement(this),_,9,_,_,_) or builtintypes(underlyingElement(this),_,10,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ class ShortType extends IntegralType {
|
|||||||
class IntType extends IntegralType {
|
class IntType extends IntegralType {
|
||||||
|
|
||||||
IntType() {
|
IntType() {
|
||||||
builtintypes(unresolveElement(this),_,11,_,_,_) or builtintypes(unresolveElement(this),_,12,_,_,_) or builtintypes(unresolveElement(this),_,13,_,_,_)
|
builtintypes(underlyingElement(this),_,11,_,_,_) or builtintypes(underlyingElement(this),_,12,_,_,_) or builtintypes(underlyingElement(this),_,13,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ class IntType extends IntegralType {
|
|||||||
class LongType extends IntegralType {
|
class LongType extends IntegralType {
|
||||||
|
|
||||||
LongType() {
|
LongType() {
|
||||||
builtintypes(unresolveElement(this),_,14,_,_,_) or builtintypes(unresolveElement(this),_,15,_,_,_) or builtintypes(unresolveElement(this),_,16,_,_,_)
|
builtintypes(underlyingElement(this),_,14,_,_,_) or builtintypes(underlyingElement(this),_,15,_,_,_) or builtintypes(underlyingElement(this),_,16,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ class LongType extends IntegralType {
|
|||||||
class LongLongType extends IntegralType {
|
class LongLongType extends IntegralType {
|
||||||
|
|
||||||
LongLongType() {
|
LongLongType() {
|
||||||
builtintypes(unresolveElement(this),_,17,_,_,_) or builtintypes(unresolveElement(this),_,18,_,_,_) or builtintypes(unresolveElement(this),_,19,_,_,_)
|
builtintypes(underlyingElement(this),_,17,_,_,_) or builtintypes(underlyingElement(this),_,18,_,_,_) or builtintypes(underlyingElement(this),_,19,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ class LongLongType extends IntegralType {
|
|||||||
class Int128Type extends IntegralType {
|
class Int128Type extends IntegralType {
|
||||||
|
|
||||||
Int128Type() {
|
Int128Type() {
|
||||||
builtintypes(unresolveElement(this),_,35,_,_,_) or builtintypes(unresolveElement(this),_,36,_,_,_) or builtintypes(unresolveElement(this),_,37,_,_,_)
|
builtintypes(underlyingElement(this),_,35,_,_,_) or builtintypes(underlyingElement(this),_,36,_,_,_) or builtintypes(underlyingElement(this),_,37,_,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -520,7 +520,7 @@ class Int128Type extends IntegralType {
|
|||||||
class FloatingPointType extends ArithmeticType {
|
class FloatingPointType extends ArithmeticType {
|
||||||
|
|
||||||
FloatingPointType() {
|
FloatingPointType() {
|
||||||
exists(int kind | builtintypes(unresolveElement(this),_,kind,_,_,_) and ((kind >= 24 and kind <= 32) or (kind = 38)))
|
exists(int kind | builtintypes(underlyingElement(this),_,kind,_,_,_) and ((kind >= 24 and kind <= 32) or (kind = 38)))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -530,7 +530,7 @@ class FloatingPointType extends ArithmeticType {
|
|||||||
*/
|
*/
|
||||||
class FloatType extends FloatingPointType {
|
class FloatType extends FloatingPointType {
|
||||||
|
|
||||||
FloatType() { builtintypes(unresolveElement(this),_,24,_,_,_) }
|
FloatType() { builtintypes(underlyingElement(this),_,24,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +539,7 @@ class FloatType extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class DoubleType extends FloatingPointType {
|
class DoubleType extends FloatingPointType {
|
||||||
|
|
||||||
DoubleType() { builtintypes(unresolveElement(this),_,25,_,_,_) }
|
DoubleType() { builtintypes(underlyingElement(this),_,25,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@ class DoubleType extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class LongDoubleType extends FloatingPointType {
|
class LongDoubleType extends FloatingPointType {
|
||||||
|
|
||||||
LongDoubleType() { builtintypes(unresolveElement(this),_,26,_,_,_) }
|
LongDoubleType() { builtintypes(underlyingElement(this),_,26,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ class LongDoubleType extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class Float128Type extends FloatingPointType {
|
class Float128Type extends FloatingPointType {
|
||||||
|
|
||||||
Float128Type() { builtintypes(unresolveElement(this),_,38,_,_,_) }
|
Float128Type() { builtintypes(underlyingElement(this),_,38,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +566,7 @@ class Float128Type extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class Decimal32Type extends FloatingPointType {
|
class Decimal32Type extends FloatingPointType {
|
||||||
|
|
||||||
Decimal32Type() { builtintypes(unresolveElement(this),_,40,_,_,_) }
|
Decimal32Type() { builtintypes(underlyingElement(this),_,40,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,7 +575,7 @@ class Decimal32Type extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class Decimal64Type extends FloatingPointType {
|
class Decimal64Type extends FloatingPointType {
|
||||||
|
|
||||||
Decimal64Type() { builtintypes(unresolveElement(this),_,41,_,_,_) }
|
Decimal64Type() { builtintypes(underlyingElement(this),_,41,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ class Decimal64Type extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class Decimal128Type extends FloatingPointType {
|
class Decimal128Type extends FloatingPointType {
|
||||||
|
|
||||||
Decimal128Type() { builtintypes(unresolveElement(this),_,42,_,_,_) }
|
Decimal128Type() { builtintypes(underlyingElement(this),_,42,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ class Decimal128Type extends FloatingPointType {
|
|||||||
*/
|
*/
|
||||||
class VoidType extends BuiltInType {
|
class VoidType extends BuiltInType {
|
||||||
|
|
||||||
VoidType() { builtintypes(unresolveElement(this),_,3,_,_,_) }
|
VoidType() { builtintypes(underlyingElement(this),_,3,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,7 +602,7 @@ class VoidType extends BuiltInType {
|
|||||||
*/
|
*/
|
||||||
class WideCharType extends IntegralType {
|
class WideCharType extends IntegralType {
|
||||||
|
|
||||||
WideCharType() { builtintypes(unresolveElement(this),_,33,_,_,_) }
|
WideCharType() { builtintypes(underlyingElement(this),_,33,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ class WideCharType extends IntegralType {
|
|||||||
*/
|
*/
|
||||||
class Char16Type extends IntegralType {
|
class Char16Type extends IntegralType {
|
||||||
|
|
||||||
Char16Type() { builtintypes(unresolveElement(this),_,43,_,_,_) }
|
Char16Type() { builtintypes(underlyingElement(this),_,43,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ class Char16Type extends IntegralType {
|
|||||||
*/
|
*/
|
||||||
class Char32Type extends IntegralType {
|
class Char32Type extends IntegralType {
|
||||||
|
|
||||||
Char32Type() { builtintypes(unresolveElement(this),_,44,_,_,_) }
|
Char32Type() { builtintypes(underlyingElement(this),_,44,_,_,_) }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,7 +634,7 @@ class Char32Type extends IntegralType {
|
|||||||
* Instead, this is the unspeakable type given by `decltype(nullptr)`.
|
* Instead, this is the unspeakable type given by `decltype(nullptr)`.
|
||||||
*/
|
*/
|
||||||
class NullPointerType extends BuiltInType {
|
class NullPointerType extends BuiltInType {
|
||||||
NullPointerType() { builtintypes(unresolveElement(this),_,34,_,_,_) }
|
NullPointerType() { builtintypes(underlyingElement(this),_,34,_,_,_) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -646,7 +646,7 @@ class NullPointerType extends BuiltInType {
|
|||||||
class DerivedType extends Type, @derivedtype {
|
class DerivedType extends Type, @derivedtype {
|
||||||
override string toString() { result = this.getName() }
|
override string toString() { result = this.getName() }
|
||||||
|
|
||||||
override string getName() { derivedtypes(unresolveElement(this),result,_,_) }
|
override string getName() { derivedtypes(underlyingElement(this),result,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base type of this derived type.
|
* Gets the base type of this derived type.
|
||||||
@@ -654,7 +654,7 @@ class DerivedType extends Type, @derivedtype {
|
|||||||
* This predicate strips off one level of decoration from a type. For example, it returns `char*` for the PointerType `char**`,
|
* This predicate strips off one level of decoration from a type. For example, it returns `char*` for the PointerType `char**`,
|
||||||
* `const int` for the ReferenceType `const int&`, and `long` for the SpecifiedType `volatile long`.
|
* `const int` for the ReferenceType `const int&`, and `long` for the SpecifiedType `volatile long`.
|
||||||
*/
|
*/
|
||||||
Type getBaseType() { derivedtypes(unresolveElement(this),_,_,unresolveElement(result)) }
|
Type getBaseType() { derivedtypes(underlyingElement(this),_,_,unresolveElement(result)) }
|
||||||
|
|
||||||
override predicate refersToDirectly(Type t) { t = this.getBaseType() }
|
override predicate refersToDirectly(Type t) { t = this.getBaseType() }
|
||||||
|
|
||||||
@@ -700,14 +700,14 @@ class Decltype extends Type, @decltype {
|
|||||||
* The expression whose type is being obtained by this decltype.
|
* The expression whose type is being obtained by this decltype.
|
||||||
*/
|
*/
|
||||||
Expr getExpr() {
|
Expr getExpr() {
|
||||||
decltypes(unresolveElement(this), unresolveElement(result), _, _)
|
decltypes(underlyingElement(this), unresolveElement(result), _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type immediately yielded by this decltype.
|
* The type immediately yielded by this decltype.
|
||||||
*/
|
*/
|
||||||
Type getBaseType() {
|
Type getBaseType() {
|
||||||
decltypes(unresolveElement(this), _, unresolveElement(result), _)
|
decltypes(underlyingElement(this), _, unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -721,7 +721,7 @@ class Decltype extends Type, @decltype {
|
|||||||
* Consult the C++11 standard for more details.
|
* Consult the C++11 standard for more details.
|
||||||
*/
|
*/
|
||||||
predicate parenthesesWouldChangeMeaning() {
|
predicate parenthesesWouldChangeMeaning() {
|
||||||
decltypes(unresolveElement(this), _, _, true)
|
decltypes(underlyingElement(this), _, _, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override Type getUnderlyingType() {
|
override Type getUnderlyingType() {
|
||||||
@@ -794,7 +794,7 @@ class Decltype extends Type, @decltype {
|
|||||||
*/
|
*/
|
||||||
class PointerType extends DerivedType {
|
class PointerType extends DerivedType {
|
||||||
|
|
||||||
PointerType() { derivedtypes(unresolveElement(this),_,1,_) }
|
PointerType() { derivedtypes(underlyingElement(this),_,1,_) }
|
||||||
|
|
||||||
override int getPointerIndirectionLevel() {
|
override int getPointerIndirectionLevel() {
|
||||||
result = 1 + this.getBaseType().getPointerIndirectionLevel()
|
result = 1 + this.getBaseType().getPointerIndirectionLevel()
|
||||||
@@ -817,7 +817,7 @@ class PointerType extends DerivedType {
|
|||||||
*/
|
*/
|
||||||
class ReferenceType extends DerivedType {
|
class ReferenceType extends DerivedType {
|
||||||
|
|
||||||
ReferenceType() { derivedtypes(unresolveElement(this),_,2,_) or derivedtypes(unresolveElement(this),_,8,_) }
|
ReferenceType() { derivedtypes(underlyingElement(this),_,2,_) or derivedtypes(underlyingElement(this),_,8,_) }
|
||||||
|
|
||||||
override int getPointerIndirectionLevel() {
|
override int getPointerIndirectionLevel() {
|
||||||
result = getBaseType().getPointerIndirectionLevel()
|
result = getBaseType().getPointerIndirectionLevel()
|
||||||
@@ -842,14 +842,14 @@ class ReferenceType extends DerivedType {
|
|||||||
* A C++11 lvalue reference type (e.g. int&).
|
* A C++11 lvalue reference type (e.g. int&).
|
||||||
*/
|
*/
|
||||||
class LValueReferenceType extends ReferenceType {
|
class LValueReferenceType extends ReferenceType {
|
||||||
LValueReferenceType() { derivedtypes(unresolveElement(this),_,2,_) }
|
LValueReferenceType() { derivedtypes(underlyingElement(this),_,2,_) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C++11 rvalue reference type (e.g. int&&).
|
* A C++11 rvalue reference type (e.g. int&&).
|
||||||
*/
|
*/
|
||||||
class RValueReferenceType extends ReferenceType {
|
class RValueReferenceType extends ReferenceType {
|
||||||
RValueReferenceType() { derivedtypes(unresolveElement(this),_,8,_) }
|
RValueReferenceType() { derivedtypes(underlyingElement(this),_,8,_) }
|
||||||
|
|
||||||
override string explain() { result = "rvalue " + super.explain() }
|
override string explain() { result = "rvalue " + super.explain() }
|
||||||
}
|
}
|
||||||
@@ -859,7 +859,7 @@ class RValueReferenceType extends ReferenceType {
|
|||||||
*/
|
*/
|
||||||
class SpecifiedType extends DerivedType {
|
class SpecifiedType extends DerivedType {
|
||||||
|
|
||||||
SpecifiedType() { derivedtypes(unresolveElement(this),_,3,_) }
|
SpecifiedType() { derivedtypes(underlyingElement(this),_,3,_) }
|
||||||
|
|
||||||
override int getSize() { result = this.getBaseType().getSize() }
|
override int getSize() { result = this.getBaseType().getSize() }
|
||||||
|
|
||||||
@@ -901,14 +901,14 @@ class SpecifiedType extends DerivedType {
|
|||||||
*/
|
*/
|
||||||
class ArrayType extends DerivedType {
|
class ArrayType extends DerivedType {
|
||||||
|
|
||||||
ArrayType() { derivedtypes(unresolveElement(this),_,4,_) }
|
ArrayType() { derivedtypes(underlyingElement(this),_,4,_) }
|
||||||
|
|
||||||
predicate hasArraySize() { arraysizes(unresolveElement(this),_,_,_) }
|
predicate hasArraySize() { arraysizes(underlyingElement(this),_,_,_) }
|
||||||
int getArraySize() { arraysizes(unresolveElement(this),result,_,_) }
|
int getArraySize() { arraysizes(underlyingElement(this),result,_,_) }
|
||||||
|
|
||||||
int getByteSize() { arraysizes(unresolveElement(this),_,result,_) }
|
int getByteSize() { arraysizes(underlyingElement(this),_,result,_) }
|
||||||
|
|
||||||
override int getAlignment() { arraysizes(unresolveElement(this), _, _, result) }
|
override int getAlignment() { arraysizes(underlyingElement(this), _, _, result) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of this array (only valid for arrays declared to be of a constant
|
* Gets the size of this array (only valid for arrays declared to be of a constant
|
||||||
@@ -941,7 +941,7 @@ class ArrayType extends DerivedType {
|
|||||||
*/
|
*/
|
||||||
class GNUVectorType extends DerivedType {
|
class GNUVectorType extends DerivedType {
|
||||||
|
|
||||||
GNUVectorType() { derivedtypes(unresolveElement(this),_,5,_) }
|
GNUVectorType() { derivedtypes(underlyingElement(this),_,5,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of elements in this vector type.
|
* Get the number of elements in this vector type.
|
||||||
@@ -952,7 +952,7 @@ class GNUVectorType extends DerivedType {
|
|||||||
* the number of elements is the value in the attribute divided by the size
|
* the number of elements is the value in the attribute divided by the size
|
||||||
* of a single element.
|
* of a single element.
|
||||||
*/
|
*/
|
||||||
int getNumElements() { arraysizes(unresolveElement(this),result,_,_) }
|
int getNumElements() { arraysizes(underlyingElement(this),result,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size, in bytes, of this vector type.
|
* Gets the size, in bytes, of this vector type.
|
||||||
@@ -963,9 +963,9 @@ class GNUVectorType extends DerivedType {
|
|||||||
* attribute, the byte size is the value in the attribute multiplied by the
|
* attribute, the byte size is the value in the attribute multiplied by the
|
||||||
* byte size of a single element.
|
* byte size of a single element.
|
||||||
*/
|
*/
|
||||||
override int getSize() { arraysizes(unresolveElement(this),_,result,_) }
|
override int getSize() { arraysizes(underlyingElement(this),_,result,_) }
|
||||||
|
|
||||||
override int getAlignment() { arraysizes(unresolveElement(this), _, _, result) }
|
override int getAlignment() { arraysizes(underlyingElement(this), _, _, result) }
|
||||||
|
|
||||||
override string explain() { result = "GNU " + getNumElements() + " element vector of {" + this.getBaseType().explain() + "}" }
|
override string explain() { result = "GNU " + getNumElements() + " element vector of {" + this.getBaseType().explain() + "}" }
|
||||||
|
|
||||||
@@ -978,7 +978,7 @@ class GNUVectorType extends DerivedType {
|
|||||||
*/
|
*/
|
||||||
class FunctionPointerType extends FunctionPointerIshType {
|
class FunctionPointerType extends FunctionPointerIshType {
|
||||||
FunctionPointerType() {
|
FunctionPointerType() {
|
||||||
derivedtypes(unresolveElement(this),_,6,_)
|
derivedtypes(underlyingElement(this),_,6,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getPointerIndirectionLevel() {
|
override int getPointerIndirectionLevel() {
|
||||||
@@ -993,7 +993,7 @@ class FunctionPointerType extends FunctionPointerIshType {
|
|||||||
*/
|
*/
|
||||||
class FunctionReferenceType extends FunctionPointerIshType {
|
class FunctionReferenceType extends FunctionPointerIshType {
|
||||||
FunctionReferenceType() {
|
FunctionReferenceType() {
|
||||||
derivedtypes(unresolveElement(this),_,7,_)
|
derivedtypes(underlyingElement(this),_,7,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getPointerIndirectionLevel() {
|
override int getPointerIndirectionLevel() {
|
||||||
@@ -1011,7 +1011,7 @@ class FunctionReferenceType extends FunctionPointerIshType {
|
|||||||
*/
|
*/
|
||||||
class BlockType extends FunctionPointerIshType {
|
class BlockType extends FunctionPointerIshType {
|
||||||
BlockType() {
|
BlockType() {
|
||||||
derivedtypes(unresolveElement(this),_,10,_)
|
derivedtypes(underlyingElement(this),_,10,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getPointerIndirectionLevel() {
|
override int getPointerIndirectionLevel() {
|
||||||
@@ -1026,24 +1026,24 @@ class BlockType extends FunctionPointerIshType {
|
|||||||
*/
|
*/
|
||||||
class FunctionPointerIshType extends DerivedType {
|
class FunctionPointerIshType extends DerivedType {
|
||||||
FunctionPointerIshType() {
|
FunctionPointerIshType() {
|
||||||
derivedtypes(unresolveElement(this),_,6, _) or
|
derivedtypes(underlyingElement(this),_,6, _) or
|
||||||
derivedtypes(unresolveElement(this),_,7, _) or
|
derivedtypes(underlyingElement(this),_,7, _) or
|
||||||
derivedtypes(unresolveElement(this),_,10,_)
|
derivedtypes(underlyingElement(this),_,10,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the return type of this function pointer type */
|
/** the return type of this function pointer type */
|
||||||
Type getReturnType() {
|
Type getReturnType() {
|
||||||
exists(RoutineType t | derivedtypes(unresolveElement(this),_,_,unresolveElement(t)) and result = t.getReturnType())
|
exists(RoutineType t | derivedtypes(underlyingElement(this),_,_,unresolveElement(t)) and result = t.getReturnType())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the type of the ith argument of this function pointer type */
|
/** the type of the ith argument of this function pointer type */
|
||||||
Type getParameterType(int i) {
|
Type getParameterType(int i) {
|
||||||
exists(RoutineType t | derivedtypes(unresolveElement(this),_,_,unresolveElement(t)) and result = t.getParameterType(i))
|
exists(RoutineType t | derivedtypes(underlyingElement(this),_,_,unresolveElement(t)) and result = t.getParameterType(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the type of an argument of this function pointer type */
|
/** the type of an argument of this function pointer type */
|
||||||
Type getAParameterType() {
|
Type getAParameterType() {
|
||||||
exists(RoutineType t | derivedtypes(unresolveElement(this),_,_,unresolveElement(t)) and result = t.getAParameterType())
|
exists(RoutineType t | derivedtypes(underlyingElement(this),_,_,unresolveElement(t)) and result = t.getAParameterType())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the number of arguments of this function pointer type */
|
/** the number of arguments of this function pointer type */
|
||||||
@@ -1070,10 +1070,10 @@ class PointerToMemberType extends Type, @ptrtomember {
|
|||||||
override string getName() { result = "..:: *" }
|
override string getName() { result = "..:: *" }
|
||||||
|
|
||||||
/** the base type of this pointer to member type */
|
/** the base type of this pointer to member type */
|
||||||
Type getBaseType() { ptrtomembers(unresolveElement(this),unresolveElement(result),_) }
|
Type getBaseType() { ptrtomembers(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
/** the class referred by this pointer to member type */
|
/** the class referred by this pointer to member type */
|
||||||
Type getClass() { ptrtomembers(unresolveElement(this),_,unresolveElement(result)) }
|
Type getClass() { ptrtomembers(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
|
|
||||||
override predicate refersToDirectly(Type t) {
|
override predicate refersToDirectly(Type t) {
|
||||||
t = this.getBaseType() or
|
t = this.getBaseType() or
|
||||||
@@ -1102,11 +1102,11 @@ class RoutineType extends Type, @routinetype {
|
|||||||
|
|
||||||
override string getName() { result = "..()(..)" }
|
override string getName() { result = "..()(..)" }
|
||||||
|
|
||||||
Type getParameterType(int n) { routinetypeargs(unresolveElement(this),n,unresolveElement(result)) }
|
Type getParameterType(int n) { routinetypeargs(underlyingElement(this),n,unresolveElement(result)) }
|
||||||
|
|
||||||
Type getAParameterType() { routinetypeargs(unresolveElement(this),_,unresolveElement(result)) }
|
Type getAParameterType() { routinetypeargs(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
|
|
||||||
Type getReturnType() { routinetypes(unresolveElement(this), unresolveElement(result)) }
|
Type getReturnType() { routinetypes(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
override string explain() {
|
override string explain() {
|
||||||
result = "function returning {" + this.getReturnType().explain() +
|
result = "function returning {" + this.getReturnType().explain() +
|
||||||
@@ -1153,9 +1153,9 @@ class RoutineType extends Type, @routinetype {
|
|||||||
*/
|
*/
|
||||||
class TemplateParameter extends UserType
|
class TemplateParameter extends UserType
|
||||||
{
|
{
|
||||||
TemplateParameter() { usertypes(unresolveElement(this), _, 7) or usertypes(unresolveElement(this), _, 8) }
|
TemplateParameter() { usertypes(underlyingElement(this), _, 7) or usertypes(underlyingElement(this), _, 8) }
|
||||||
|
|
||||||
override string getName() { usertypes(unresolveElement(this), result, _) }
|
override string getName() { usertypes(underlyingElement(this), result, _) }
|
||||||
|
|
||||||
override predicate involvesTemplateParameter() {
|
override predicate involvesTemplateParameter() {
|
||||||
any()
|
any()
|
||||||
@@ -1166,7 +1166,7 @@ class TemplateParameter extends UserType
|
|||||||
class TemplateTemplateParameter extends TemplateParameter
|
class TemplateTemplateParameter extends TemplateParameter
|
||||||
{
|
{
|
||||||
TemplateTemplateParameter() {
|
TemplateTemplateParameter() {
|
||||||
usertypes(unresolveElement(this), _, 8)
|
usertypes(underlyingElement(this), _, 8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,7 +1175,7 @@ class TemplateTemplateParameter extends TemplateParameter
|
|||||||
*/
|
*/
|
||||||
class AutoType extends TemplateParameter
|
class AutoType extends TemplateParameter
|
||||||
{
|
{
|
||||||
AutoType() { usertypes(unresolveElement(this), "auto", 7) }
|
AutoType() { usertypes(underlyingElement(this), "auto", 7) }
|
||||||
|
|
||||||
override Location getLocation() {
|
override Location getLocation() {
|
||||||
suppressUnusedThis(this) and
|
suppressUnusedThis(this) and
|
||||||
@@ -1209,8 +1209,8 @@ class TypeMention extends Locatable, @type_mention {
|
|||||||
/**
|
/**
|
||||||
* Gets the type being referenced by this type mention.
|
* Gets the type being referenced by this type mention.
|
||||||
*/
|
*/
|
||||||
Type getMentionedType() { type_mentions(unresolveElement(this), unresolveElement(result), _, _) }
|
Type getMentionedType() { type_mentions(underlyingElement(this), unresolveElement(result), _, _) }
|
||||||
|
|
||||||
override Location getLocation() { type_mentions(unresolveElement(this), _, result, _)}
|
override Location getLocation() { type_mentions(underlyingElement(this), _, result, _)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ private import semmle.code.cpp.internal.Type
|
|||||||
*/
|
*/
|
||||||
class TypedefType extends UserType {
|
class TypedefType extends UserType {
|
||||||
|
|
||||||
TypedefType() { usertypes(unresolveElement(this),_,5) }
|
TypedefType() { usertypes(underlyingElement(this),_,5) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base type of this typedef type.
|
* Gets the base type of this typedef type.
|
||||||
*/
|
*/
|
||||||
Type getBaseType() { typedefbase(unresolveElement(this),unresolveElement(result)) }
|
Type getBaseType() { typedefbase(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
|
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import semmle.code.cpp.Struct
|
|||||||
*/
|
*/
|
||||||
class Union extends Struct {
|
class Union extends Struct {
|
||||||
|
|
||||||
Union() { usertypes(unresolveElement(this),_,3) }
|
Union() { usertypes(underlyingElement(this),_,3) }
|
||||||
|
|
||||||
override string explain() { result = "union " + this.getName() }
|
override string explain() { result = "union " + this.getName() }
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ private import semmle.code.cpp.internal.Type
|
|||||||
*/
|
*/
|
||||||
class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @usertype {
|
class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @usertype {
|
||||||
/** the name of this type */
|
/** the name of this type */
|
||||||
override string getName() { usertypes(unresolveElement(this),result,_) }
|
override string getName() { usertypes(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/** the simple name of this type, without any template parameters */
|
/** the simple name of this type, without any template parameters */
|
||||||
string getSimpleName() {
|
string getSimpleName() {
|
||||||
@@ -18,7 +18,7 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
|
|||||||
}
|
}
|
||||||
|
|
||||||
override predicate hasName(string name) {
|
override predicate hasName(string name) {
|
||||||
usertypes(unresolveElement(this),name,_)
|
usertypes(underlyingElement(this),name,_)
|
||||||
}
|
}
|
||||||
predicate isAnonymous() {
|
predicate isAnonymous() {
|
||||||
getName().matches("(unnamed%")
|
getName().matches("(unnamed%")
|
||||||
@@ -39,8 +39,8 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
|
|||||||
}
|
}
|
||||||
|
|
||||||
override TypeDeclarationEntry getADeclarationEntry() {
|
override TypeDeclarationEntry getADeclarationEntry() {
|
||||||
if type_decls(_, unresolveElement(this), _) then
|
if type_decls(_, underlyingElement(this), _) then
|
||||||
type_decls(unresolveElement(result), unresolveElement(this), _)
|
type_decls(unresolveElement(result), underlyingElement(this), _)
|
||||||
else
|
else
|
||||||
exists(Class t | this.(Class).isConstructedFrom(t) and result = t.getADeclarationEntry())
|
exists(Class t | this.(Class).isConstructedFrom(t) and result = t.getADeclarationEntry())
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
|
|||||||
|
|
||||||
/** Gets the function that directly encloses this type (if any). */
|
/** Gets the function that directly encloses this type (if any). */
|
||||||
Function getEnclosingFunction() {
|
Function getEnclosingFunction() {
|
||||||
enclosingfunction(unresolveElement(this),unresolveElement(result))
|
enclosingfunction(underlyingElement(this),unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether this is a local type (i.e. a type that has a directly-enclosing function). */
|
/** Whether this is a local type (i.e. a type that has a directly-enclosing function). */
|
||||||
@@ -96,15 +96,15 @@ class TypeDeclarationEntry extends DeclarationEntry, @type_decl {
|
|||||||
/**
|
/**
|
||||||
* The type which is being declared or defined.
|
* The type which is being declared or defined.
|
||||||
*/
|
*/
|
||||||
override Type getType() { type_decls(unresolveElement(this),unresolveElement(result),_) }
|
override Type getType() { type_decls(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
override Location getLocation() { type_decls(unresolveElement(this),_,result) }
|
override Location getLocation() { type_decls(underlyingElement(this),_,result) }
|
||||||
override predicate isDefinition() { type_def(unresolveElement(this)) }
|
override predicate isDefinition() { type_def(underlyingElement(this)) }
|
||||||
override string getASpecifier() { none() }
|
override string getASpecifier() { none() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A top level type declaration entry is not declared within a function, function declaration,
|
* A top level type declaration entry is not declared within a function, function declaration,
|
||||||
* class or typedef.
|
* class or typedef.
|
||||||
*/
|
*/
|
||||||
predicate isTopLevel() { type_decl_top(unresolveElement(this)) }
|
predicate isTopLevel() { type_decl_top(underlyingElement(this)) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ class Variable extends Declaration, @variable {
|
|||||||
* this variable, such as `const` and `volatile`, are instead accessed
|
* this variable, such as `const` and `volatile`, are instead accessed
|
||||||
* through `this.getType().getASpecifier()`.
|
* through `this.getType().getASpecifier()`.
|
||||||
*/
|
*/
|
||||||
override Specifier getASpecifier() { varspecifiers(unresolveElement(this),unresolveElement(result)) }
|
override Specifier getASpecifier() { varspecifiers(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets an attribute of this variable. */
|
/** Gets an attribute of this variable. */
|
||||||
Attribute getAnAttribute() { varattributes(unresolveElement(this),unresolveElement(result)) }
|
Attribute getAnAttribute() { varattributes(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Holds if this variable is `const`. */
|
/** Holds if this variable is `const`. */
|
||||||
predicate isConst() { this.getType().isConst() }
|
predicate isConst() { this.getType().isConst() }
|
||||||
@@ -67,13 +67,13 @@ class Variable extends Declaration, @variable {
|
|||||||
*
|
*
|
||||||
* `const auto& c = container;`
|
* `const auto& c = container;`
|
||||||
*/
|
*/
|
||||||
Type getTypeWithAuto() { autoderivation(unresolveElement(this), unresolveElement(result)) }
|
Type getTypeWithAuto() { autoderivation(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if the type of this variable is declared using the C++ `auto`
|
* Holds if the type of this variable is declared using the C++ `auto`
|
||||||
* keyword.
|
* keyword.
|
||||||
*/
|
*/
|
||||||
predicate declaredUsingAutoType() { autoderivation(unresolveElement(this), _) }
|
predicate declaredUsingAutoType() { autoderivation(underlyingElement(this), _) }
|
||||||
|
|
||||||
override VariableDeclarationEntry getADeclarationEntry() {
|
override VariableDeclarationEntry getADeclarationEntry() {
|
||||||
result.getDeclaration() = this
|
result.getDeclaration() = this
|
||||||
@@ -127,7 +127,7 @@ class Variable extends Declaration, @variable {
|
|||||||
* variable or from a variable nested in a template class.
|
* variable or from a variable nested in a template class.
|
||||||
*/
|
*/
|
||||||
predicate isConstructedFrom(Variable v) {
|
predicate isConstructedFrom(Variable v) {
|
||||||
variable_instantiation(unresolveElement(this), unresolveElement(v))
|
variable_instantiation(underlyingElement(this), unresolveElement(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +143,7 @@ class Variable extends Declaration, @variable {
|
|||||||
* template variable.
|
* template variable.
|
||||||
*/
|
*/
|
||||||
Type getTemplateArgument(int index) {
|
Type getTemplateArgument(int index) {
|
||||||
variable_template_argument(unresolveElement(this), index, unresolveElement(result))
|
variable_template_argument(underlyingElement(this), index, unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +154,7 @@ class Variable extends Declaration, @variable {
|
|||||||
*
|
*
|
||||||
* `for (char c : str) { ... }`
|
* `for (char c : str) { ... }`
|
||||||
*/
|
*/
|
||||||
predicate isCompilerGenerated() { compgenerated(unresolveElement(this)) }
|
predicate isCompilerGenerated() { compgenerated(underlyingElement(this)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +166,7 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
|
|||||||
/**
|
/**
|
||||||
* Gets the variable which is being declared or defined.
|
* Gets the variable which is being declared or defined.
|
||||||
*/
|
*/
|
||||||
Variable getVariable() { var_decls(unresolveElement(this),unresolveElement(result),_,_,_) }
|
Variable getVariable() { var_decls(underlyingElement(this),unresolveElement(result),_,_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name, if any, used for the variable at this declaration or
|
* Gets the name, if any, used for the variable at this declaration or
|
||||||
@@ -185,14 +185,14 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
|
|||||||
* int f(int y) { return y; }
|
* int f(int y) { return y; }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
override string getName() { var_decls(unresolveElement(this),_,_,result,_) and result != "" }
|
override string getName() { var_decls(underlyingElement(this),_,_,result,_) and result != "" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the variable which is being declared or defined.
|
* Gets the type of the variable which is being declared or defined.
|
||||||
*/
|
*/
|
||||||
override Type getType() { var_decls(unresolveElement(this),_,unresolveElement(result),_,_) }
|
override Type getType() { var_decls(underlyingElement(this),_,unresolveElement(result),_,_) }
|
||||||
|
|
||||||
override Location getLocation() { var_decls(unresolveElement(this),_,_,_,result) }
|
override Location getLocation() { var_decls(underlyingElement(this),_,_,_,result) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this is a definition of a variable.
|
* Holds if this is a definition of a variable.
|
||||||
@@ -202,9 +202,9 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
|
|||||||
* this holds precisely when the enclosing `FunctionDeclarationEntry` is
|
* this holds precisely when the enclosing `FunctionDeclarationEntry` is
|
||||||
* a definition.
|
* a definition.
|
||||||
*/
|
*/
|
||||||
override predicate isDefinition() { var_def(unresolveElement(this)) }
|
override predicate isDefinition() { var_def(underlyingElement(this)) }
|
||||||
|
|
||||||
override string getASpecifier() { var_decl_specifiers(unresolveElement(this),result) }
|
override string getASpecifier() { var_decl_specifiers(underlyingElement(this),result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -212,20 +212,20 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
|
|||||||
* of a C/C++ function.
|
* of a C/C++ function.
|
||||||
*/
|
*/
|
||||||
class ParameterDeclarationEntry extends VariableDeclarationEntry {
|
class ParameterDeclarationEntry extends VariableDeclarationEntry {
|
||||||
ParameterDeclarationEntry() { param_decl_bind(unresolveElement(this),_,_) }
|
ParameterDeclarationEntry() { param_decl_bind(underlyingElement(this),_,_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the function declaration or definition which this parameter
|
* Gets the function declaration or definition which this parameter
|
||||||
* description is part of.
|
* description is part of.
|
||||||
*/
|
*/
|
||||||
FunctionDeclarationEntry getFunctionDeclarationEntry() {
|
FunctionDeclarationEntry getFunctionDeclarationEntry() {
|
||||||
param_decl_bind(unresolveElement(this),_,unresolveElement(result))
|
param_decl_bind(underlyingElement(this),_,unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the zero-based index of this parameter.
|
* Gets the zero-based index of this parameter.
|
||||||
*/
|
*/
|
||||||
int getIndex() { param_decl_bind(unresolveElement(this),result,_) }
|
int getIndex() { param_decl_bind(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
if exists(getName())
|
if exists(getName())
|
||||||
@@ -286,9 +286,9 @@ deprecated class StackVariable extends Variable {
|
|||||||
* scope [N4140 3.3.3], but is not a function parameter.
|
* scope [N4140 3.3.3], but is not a function parameter.
|
||||||
*/
|
*/
|
||||||
class LocalVariable extends LocalScopeVariable, @localvariable {
|
class LocalVariable extends LocalScopeVariable, @localvariable {
|
||||||
override string getName() { localvariables(unresolveElement(this),_,result) }
|
override string getName() { localvariables(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
override Type getType() { localvariables(unresolveElement(this),unresolveElement(result),_) }
|
override Type getType() { localvariables(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
override Function getFunction() {
|
override Function getFunction() {
|
||||||
exists(DeclStmt s | s.getADeclaration() = this and s.getEnclosingFunction() = result)
|
exists(DeclStmt s | s.getADeclaration() = this and s.getEnclosingFunction() = result)
|
||||||
@@ -299,9 +299,9 @@ class LocalVariable extends LocalScopeVariable, @localvariable {
|
|||||||
* A C/C++ variable which has global scope or namespace scope.
|
* A C/C++ variable which has global scope or namespace scope.
|
||||||
*/
|
*/
|
||||||
class GlobalOrNamespaceVariable extends Variable, @globalvariable {
|
class GlobalOrNamespaceVariable extends Variable, @globalvariable {
|
||||||
override string getName() { globalvariables(unresolveElement(this),_,result) }
|
override string getName() { globalvariables(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
override Type getType() { globalvariables(unresolveElement(this),unresolveElement(result),_) }
|
override Type getType() { globalvariables(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
override Element getEnclosingElement() { none() }
|
override Element getEnclosingElement() { none() }
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ class GlobalOrNamespaceVariable extends Variable, @globalvariable {
|
|||||||
*/
|
*/
|
||||||
class NamespaceVariable extends GlobalOrNamespaceVariable {
|
class NamespaceVariable extends GlobalOrNamespaceVariable {
|
||||||
NamespaceVariable() {
|
NamespaceVariable() {
|
||||||
exists(Namespace n | namespacembrs(unresolveElement(n), unresolveElement(this)))
|
exists(Namespace n | namespacembrs(unresolveElement(n), underlyingElement(this)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ class MemberVariable extends Variable, @membervariable {
|
|||||||
/** Holds if this member is public. */
|
/** Holds if this member is public. */
|
||||||
predicate isPublic() { this.hasSpecifier("public") }
|
predicate isPublic() { this.hasSpecifier("public") }
|
||||||
|
|
||||||
override string getName() { membervariables(unresolveElement(this),_,result) }
|
override string getName() { membervariables(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
override Type getType() {
|
override Type getType() {
|
||||||
if (strictcount(this.getAType()) = 1) then (
|
if (strictcount(this.getAType()) = 1) then (
|
||||||
@@ -366,7 +366,7 @@ class MemberVariable extends Variable, @membervariable {
|
|||||||
getADeclarationEntry().hasSpecifier("mutable")
|
getADeclarationEntry().hasSpecifier("mutable")
|
||||||
}
|
}
|
||||||
|
|
||||||
private Type getAType() { membervariables(unresolveElement(this),unresolveElement(result),_) }
|
private Type getAType() { membervariables(underlyingElement(this),unresolveElement(result),_) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -391,7 +391,7 @@ class FunctionPointerMemberVariable extends MemberVariable {
|
|||||||
* A C++14 variable template.
|
* A C++14 variable template.
|
||||||
*/
|
*/
|
||||||
class TemplateVariable extends Variable {
|
class TemplateVariable extends Variable {
|
||||||
TemplateVariable() { is_variable_template(unresolveElement(this)) }
|
TemplateVariable() { is_variable_template(underlyingElement(this)) }
|
||||||
Variable getAnInstantiation() { result.isConstructedFrom(this) }
|
Variable getAnInstantiation() { result.isConstructedFrom(this) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ private import semmle.code.cpp.controlflow.internal.ConstantExprs
|
|||||||
*/
|
*/
|
||||||
class ControlFlowNode extends Locatable, @cfgnode {
|
class ControlFlowNode extends Locatable, @cfgnode {
|
||||||
|
|
||||||
ControlFlowNode getASuccessor() { successors_adapted(unresolveElement(this),unresolveElement(result)) }
|
ControlFlowNode getASuccessor() { successors_adapted(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
ControlFlowNode getAPredecessor() { this = result.getASuccessor() }
|
ControlFlowNode getAPredecessor() { this = result.getASuccessor() }
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class ControlFlowNode extends Locatable, @cfgnode {
|
|||||||
* taken when this expression is true.
|
* taken when this expression is true.
|
||||||
*/
|
*/
|
||||||
ControlFlowNode getATrueSuccessor() {
|
ControlFlowNode getATrueSuccessor() {
|
||||||
truecond(unresolveElement(this),unresolveElement(result)) and result = getASuccessor()
|
truecond(underlyingElement(this),unresolveElement(result)) and result = getASuccessor()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +62,7 @@ class ControlFlowNode extends Locatable, @cfgnode {
|
|||||||
* taken when this expression is false.
|
* taken when this expression is false.
|
||||||
*/
|
*/
|
||||||
ControlFlowNode getAFalseSuccessor() {
|
ControlFlowNode getAFalseSuccessor() {
|
||||||
falsecond(unresolveElement(this),unresolveElement(result)) and result = getASuccessor()
|
falsecond(underlyingElement(this),unresolveElement(result)) and result = getASuccessor()
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicBlock getBasicBlock() {
|
BasicBlock getBasicBlock() {
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ abstract class Access extends Expr, NameQualifiableElement {
|
|||||||
*/
|
*/
|
||||||
class EnumConstantAccess extends Access, @varaccess {
|
class EnumConstantAccess extends Access, @varaccess {
|
||||||
EnumConstantAccess() {
|
EnumConstantAccess() {
|
||||||
exists(EnumConstant c | varbind(unresolveElement(this), unresolveElement(c)))
|
exists(EnumConstant c | varbind(underlyingElement(this), unresolveElement(c)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the accessed enum constant. */
|
/** Gets the accessed enum constant. */
|
||||||
override EnumConstant getTarget() { varbind(unresolveElement(this), unresolveElement(result)) }
|
override EnumConstant getTarget() { varbind(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets a textual representation of this enum constant access. */
|
/** Gets a textual representation of this enum constant access. */
|
||||||
override string toString() { result = this.getTarget().getName() }
|
override string toString() { result = this.getTarget().getName() }
|
||||||
@@ -40,11 +40,11 @@ class EnumConstantAccess extends Access, @varaccess {
|
|||||||
*/
|
*/
|
||||||
class VariableAccess extends Access, @varaccess {
|
class VariableAccess extends Access, @varaccess {
|
||||||
VariableAccess() {
|
VariableAccess() {
|
||||||
not exists(EnumConstant c | varbind(unresolveElement(this), unresolveElement(c)))
|
not exists(EnumConstant c | varbind(underlyingElement(this), unresolveElement(c)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the accessed variable. */
|
/** Gets the accessed variable. */
|
||||||
override Variable getTarget() { varbind(unresolveElement(this), unresolveElement(result)) }
|
override Variable getTarget() { varbind(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this variable access is providing an LValue in a meaningful way.
|
* Holds if this variable access is providing an LValue in a meaningful way.
|
||||||
@@ -133,7 +133,7 @@ class VariableAccess extends Access, @varaccess {
|
|||||||
* A C/C++ field access expression.
|
* A C/C++ field access expression.
|
||||||
*/
|
*/
|
||||||
class FieldAccess extends VariableAccess {
|
class FieldAccess extends VariableAccess {
|
||||||
FieldAccess() { exists(Field f | varbind(unresolveElement(this), unresolveElement(f))) }
|
FieldAccess() { exists(Field f | varbind(underlyingElement(this), unresolveElement(f))) }
|
||||||
|
|
||||||
/** Gets the accessed field. */
|
/** Gets the accessed field. */
|
||||||
override Field getTarget() { result = super.getTarget() }
|
override Field getTarget() { result = super.getTarget() }
|
||||||
@@ -230,11 +230,11 @@ class ImplicitThisFieldAccess extends FieldAccess {
|
|||||||
*/
|
*/
|
||||||
class FunctionAccess extends Access, @routineexpr {
|
class FunctionAccess extends Access, @routineexpr {
|
||||||
FunctionAccess() {
|
FunctionAccess() {
|
||||||
not iscall(unresolveElement(this),_)
|
not iscall(underlyingElement(this),_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the accessed function. */
|
/** Gets the accessed function. */
|
||||||
override Function getTarget() { funbind(unresolveElement(this), unresolveElement(result)) }
|
override Function getTarget() { funbind(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets a textual representation of this function access. */
|
/** Gets a textual representation of this function access. */
|
||||||
override string toString() {
|
override string toString() {
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class ConditionDeclExpr extends Expr, @condition_decl {
|
|||||||
Expr getExpr() { result = this.getChild(0) }
|
Expr getExpr() { result = this.getChild(0) }
|
||||||
|
|
||||||
/** Gets the variable that is declared. */
|
/** Gets the variable that is declared. */
|
||||||
Variable getVariable() { condition_decl_bind(unresolveElement(this),unresolveElement(result)) }
|
Variable getVariable() { condition_decl_bind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
override string toString() { result = "(condition decl)" }
|
override string toString() { result = "(condition decl)" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ abstract class Call extends Expr, NameQualifiableElement {
|
|||||||
*/
|
*/
|
||||||
class FunctionCall extends Call, @funbindexpr {
|
class FunctionCall extends Call, @funbindexpr {
|
||||||
FunctionCall() {
|
FunctionCall() {
|
||||||
iscall(unresolveElement(this),_)
|
iscall(underlyingElement(this),_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets an explicit template argument for this call. */
|
/** Gets an explicit template argument for this call. */
|
||||||
@@ -167,8 +167,8 @@ class FunctionCall extends Call, @funbindexpr {
|
|||||||
|
|
||||||
/** Gets the number of explicit template arguments for this call. */
|
/** Gets the number of explicit template arguments for this call. */
|
||||||
int getNumberOfExplicitTemplateArguments() {
|
int getNumberOfExplicitTemplateArguments() {
|
||||||
if numtemplatearguments(unresolveElement(this),_) then
|
if numtemplatearguments(underlyingElement(this),_) then
|
||||||
numtemplatearguments(unresolveElement(this),result)
|
numtemplatearguments(underlyingElement(this),result)
|
||||||
else
|
else
|
||||||
result = 0
|
result = 0
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ class FunctionCall extends Call, @funbindexpr {
|
|||||||
|
|
||||||
/** Holds if a template argument list was provided for this call. */
|
/** Holds if a template argument list was provided for this call. */
|
||||||
predicate hasTemplateArgumentList() {
|
predicate hasTemplateArgumentList() {
|
||||||
numtemplatearguments(unresolveElement(this),_)
|
numtemplatearguments(underlyingElement(this),_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -240,7 +240,7 @@ class FunctionCall extends Call, @funbindexpr {
|
|||||||
* In the case of virtual function calls, the result is the most-specific function in the override tree (as
|
* In the case of virtual function calls, the result is the most-specific function in the override tree (as
|
||||||
* determined by the compiler) such that the target at runtime will be one of result.getAnOverridingFunction*().
|
* determined by the compiler) such that the target at runtime will be one of result.getAnOverridingFunction*().
|
||||||
*/
|
*/
|
||||||
override Function getTarget() { funbind(unresolveElement(this),unresolveElement(result)) }
|
override Function getTarget() { funbind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of this expression, that is, the return type of the function being called.
|
* Gets the type of this expression, that is, the return type of the function being called.
|
||||||
@@ -253,7 +253,7 @@ class FunctionCall extends Call, @funbindexpr {
|
|||||||
* Note that this holds even in cases where a sufficiently clever compiler could perform static dispatch.
|
* Note that this holds even in cases where a sufficiently clever compiler could perform static dispatch.
|
||||||
*/
|
*/
|
||||||
predicate isVirtual() {
|
predicate isVirtual() {
|
||||||
iscall(unresolveElement(this),1)
|
iscall(underlyingElement(this),1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -261,7 +261,7 @@ class FunctionCall extends Call, @funbindexpr {
|
|||||||
* found by any other means.
|
* found by any other means.
|
||||||
*/
|
*/
|
||||||
predicate isOnlyFoundByADL() {
|
predicate isOnlyFoundByADL() {
|
||||||
iscall(unresolveElement(this),2)
|
iscall(underlyingElement(this),2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this function call. */
|
/** Gets a textual representation of this function call. */
|
||||||
@@ -477,7 +477,7 @@ class ConstructorDelegationInit extends ConstructorBaseInit, @ctordelegatinginit
|
|||||||
*/
|
*/
|
||||||
class ConstructorFieldInit extends ConstructorInit, @ctorfieldinit {
|
class ConstructorFieldInit extends ConstructorInit, @ctorfieldinit {
|
||||||
/** Gets the field being initialized. */
|
/** Gets the field being initialized. */
|
||||||
Field getTarget() { varbind(unresolveElement(this),unresolveElement(result)) }
|
Field getTarget() { varbind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the expression to which the field is initialized.
|
* Gets the expression to which the field is initialized.
|
||||||
@@ -536,7 +536,7 @@ class DestructorVirtualDestruction extends DestructorBaseDestruction, @dtorvirtu
|
|||||||
*/
|
*/
|
||||||
class DestructorFieldDestruction extends DestructorDestruction, @dtorfielddestruct {
|
class DestructorFieldDestruction extends DestructorDestruction, @dtorfielddestruct {
|
||||||
/** Gets the field being destructed. */
|
/** Gets the field being destructed. */
|
||||||
Field getTarget() { varbind(unresolveElement(this),unresolveElement(result)) }
|
Field getTarget() { varbind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets the compiler-generated call to the variable's destructor. */
|
/** Gets the compiler-generated call to the variable's destructor. */
|
||||||
DestructorCall getExpr() { result = this.getChild(0) }
|
DestructorCall getExpr() { result = this.getChild(0) }
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ private predicate isPointerToMemberOrNullPointer(Type type) {
|
|||||||
*/
|
*/
|
||||||
class ArithmeticConversion extends Cast {
|
class ArithmeticConversion extends Cast {
|
||||||
ArithmeticConversion() {
|
ArithmeticConversion() {
|
||||||
conversionkinds(unresolveElement(this), 0) and
|
conversionkinds(underlyingElement(this), 0) and
|
||||||
isArithmeticOrEnum(getType().getUnspecifiedType()) and
|
isArithmeticOrEnum(getType().getUnspecifiedType()) and
|
||||||
isArithmeticOrEnum(getExpr().getType().getUnspecifiedType())
|
isArithmeticOrEnum(getExpr().getType().getUnspecifiedType())
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ class IntegralToFloatingPointConversion extends ArithmeticConversion {
|
|||||||
*/
|
*/
|
||||||
class PointerConversion extends Cast {
|
class PointerConversion extends Cast {
|
||||||
PointerConversion() {
|
PointerConversion() {
|
||||||
conversionkinds(unresolveElement(this), 0) and
|
conversionkinds(underlyingElement(this), 0) and
|
||||||
isPointerOrNullPointer(getType().getUnspecifiedType()) and
|
isPointerOrNullPointer(getType().getUnspecifiedType()) and
|
||||||
isPointerOrNullPointer(getExpr().getType().getUnspecifiedType())
|
isPointerOrNullPointer(getExpr().getType().getUnspecifiedType())
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ class PointerConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class PointerToMemberConversion extends Cast {
|
class PointerToMemberConversion extends Cast {
|
||||||
PointerToMemberConversion() {
|
PointerToMemberConversion() {
|
||||||
conversionkinds(unresolveElement(this), 0) and
|
conversionkinds(underlyingElement(this), 0) and
|
||||||
exists(Type fromType, Type toType |
|
exists(Type fromType, Type toType |
|
||||||
fromType = getExpr().getType().getUnspecifiedType() and
|
fromType = getExpr().getType().getUnspecifiedType() and
|
||||||
toType = getType().getUnspecifiedType() and
|
toType = getType().getUnspecifiedType() and
|
||||||
@@ -253,7 +253,7 @@ class PointerToMemberConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class PointerToIntegralConversion extends Cast {
|
class PointerToIntegralConversion extends Cast {
|
||||||
PointerToIntegralConversion() {
|
PointerToIntegralConversion() {
|
||||||
conversionkinds(unresolveElement(this), 0) and
|
conversionkinds(underlyingElement(this), 0) and
|
||||||
isIntegralOrEnum(getType().getUnspecifiedType()) and
|
isIntegralOrEnum(getType().getUnspecifiedType()) and
|
||||||
isPointerOrNullPointer(getExpr().getType().getUnspecifiedType())
|
isPointerOrNullPointer(getExpr().getType().getUnspecifiedType())
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ class PointerToIntegralConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class IntegralToPointerConversion extends Cast {
|
class IntegralToPointerConversion extends Cast {
|
||||||
IntegralToPointerConversion() {
|
IntegralToPointerConversion() {
|
||||||
conversionkinds(unresolveElement(this), 0) and
|
conversionkinds(underlyingElement(this), 0) and
|
||||||
isPointerOrNullPointer(getType().getUnspecifiedType()) and
|
isPointerOrNullPointer(getType().getUnspecifiedType()) and
|
||||||
isIntegralOrEnum(getExpr().getType().getUnspecifiedType())
|
isIntegralOrEnum(getExpr().getType().getUnspecifiedType())
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ class IntegralToPointerConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class BoolConversion extends Cast {
|
class BoolConversion extends Cast {
|
||||||
BoolConversion() {
|
BoolConversion() {
|
||||||
conversionkinds(unresolveElement(this), 1)
|
conversionkinds(underlyingElement(this), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -315,7 +315,7 @@ class VoidConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class InheritanceConversion extends Cast {
|
class InheritanceConversion extends Cast {
|
||||||
InheritanceConversion() {
|
InheritanceConversion() {
|
||||||
conversionkinds(unresolveElement(this), 2) or conversionkinds(unresolveElement(this), 3)
|
conversionkinds(underlyingElement(this), 2) or conversionkinds(underlyingElement(this), 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -367,7 +367,7 @@ private Class getConversionClass(Expr expr) {
|
|||||||
*/
|
*/
|
||||||
class BaseClassConversion extends InheritanceConversion {
|
class BaseClassConversion extends InheritanceConversion {
|
||||||
BaseClassConversion() {
|
BaseClassConversion() {
|
||||||
conversionkinds(unresolveElement(this), 2)
|
conversionkinds(underlyingElement(this), 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -396,7 +396,7 @@ class BaseClassConversion extends InheritanceConversion {
|
|||||||
*/
|
*/
|
||||||
class DerivedClassConversion extends InheritanceConversion {
|
class DerivedClassConversion extends InheritanceConversion {
|
||||||
DerivedClassConversion() {
|
DerivedClassConversion() {
|
||||||
conversionkinds(unresolveElement(this), 3)
|
conversionkinds(underlyingElement(this), 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -418,7 +418,7 @@ class DerivedClassConversion extends InheritanceConversion {
|
|||||||
*/
|
*/
|
||||||
class PointerToMemberBaseClassConversion extends Cast {
|
class PointerToMemberBaseClassConversion extends Cast {
|
||||||
PointerToMemberBaseClassConversion() {
|
PointerToMemberBaseClassConversion() {
|
||||||
conversionkinds(unresolveElement(this), 4)
|
conversionkinds(underlyingElement(this), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -432,7 +432,7 @@ class PointerToMemberBaseClassConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class PointerToMemberDerivedClassConversion extends Cast {
|
class PointerToMemberDerivedClassConversion extends Cast {
|
||||||
PointerToMemberDerivedClassConversion() {
|
PointerToMemberDerivedClassConversion() {
|
||||||
conversionkinds(unresolveElement(this), 5)
|
conversionkinds(underlyingElement(this), 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -447,7 +447,7 @@ class PointerToMemberDerivedClassConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class GlvalueConversion extends Cast {
|
class GlvalueConversion extends Cast {
|
||||||
GlvalueConversion() {
|
GlvalueConversion() {
|
||||||
conversionkinds(unresolveElement(this), 6)
|
conversionkinds(underlyingElement(this), 6)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -471,7 +471,7 @@ class GlvalueConversion extends Cast {
|
|||||||
*/
|
*/
|
||||||
class PrvalueAdjustmentConversion extends Cast {
|
class PrvalueAdjustmentConversion extends Cast {
|
||||||
PrvalueAdjustmentConversion() {
|
PrvalueAdjustmentConversion() {
|
||||||
conversionkinds(unresolveElement(this), 7)
|
conversionkinds(underlyingElement(this), 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string getSemanticConversionString() {
|
override string getSemanticConversionString() {
|
||||||
@@ -503,7 +503,7 @@ class UuidofOperator extends Expr, @uuidof {
|
|||||||
|
|
||||||
/** Gets the contained type. */
|
/** Gets the contained type. */
|
||||||
Type getTypeOperand() {
|
Type getTypeOperand() {
|
||||||
uuidof_bind(unresolveElement(this), unresolveElement(result))
|
uuidof_bind(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ class TypeidOperator extends Expr, @type_id {
|
|||||||
* printf("the type of ptr is: %s\n", typeid(ptr).name);
|
* printf("the type of ptr is: %s\n", typeid(ptr).name);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
Type getResultType() { typeid_bind(unresolveElement(this),unresolveElement(result)) }
|
Type getResultType() { typeid_bind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Use `getResultType()` instead.
|
* DEPRECATED: Use `getResultType()` instead.
|
||||||
@@ -605,10 +605,10 @@ class SizeofExprOperator extends SizeofOperator {
|
|||||||
* A C/C++ sizeof expression whose operand is a type name.
|
* A C/C++ sizeof expression whose operand is a type name.
|
||||||
*/
|
*/
|
||||||
class SizeofTypeOperator extends SizeofOperator {
|
class SizeofTypeOperator extends SizeofOperator {
|
||||||
SizeofTypeOperator() { sizeof_bind(unresolveElement(this),_) }
|
SizeofTypeOperator() { sizeof_bind(underlyingElement(this),_) }
|
||||||
|
|
||||||
/** Gets the contained type. */
|
/** Gets the contained type. */
|
||||||
Type getTypeOperand() { sizeof_bind(unresolveElement(this),unresolveElement(result)) }
|
Type getTypeOperand() { sizeof_bind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Use `getTypeOperand()` instead
|
* DEPRECATED: Use `getTypeOperand()` instead
|
||||||
@@ -657,10 +657,10 @@ class AlignofExprOperator extends AlignofOperator {
|
|||||||
* A C++11 `alignof` expression whose operand is a type name.
|
* A C++11 `alignof` expression whose operand is a type name.
|
||||||
*/
|
*/
|
||||||
class AlignofTypeOperator extends AlignofOperator {
|
class AlignofTypeOperator extends AlignofOperator {
|
||||||
AlignofTypeOperator() { sizeof_bind(unresolveElement(this),_) }
|
AlignofTypeOperator() { sizeof_bind(underlyingElement(this),_) }
|
||||||
|
|
||||||
/** Gets the contained type. */
|
/** Gets the contained type. */
|
||||||
Type getTypeOperand() { sizeof_bind(unresolveElement(this),unresolveElement(result)) }
|
Type getTypeOperand() { sizeof_bind(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Use `getTypeOperand()` instead.
|
* DEPRECATED: Use `getTypeOperand()` instead.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ private import semmle.code.cpp.internal.Type
|
|||||||
*/
|
*/
|
||||||
class Expr extends StmtParent, @expr {
|
class Expr extends StmtParent, @expr {
|
||||||
/** Gets the nth child of this expression. */
|
/** Gets the nth child of this expression. */
|
||||||
Expr getChild(int n) { exprparents(unresolveElement(result),n,unresolveElement(this)) }
|
Expr getChild(int n) { exprparents(unresolveElement(result),n,underlyingElement(this)) }
|
||||||
|
|
||||||
/** Gets the number of direct children of this expression. */
|
/** Gets the number of direct children of this expression. */
|
||||||
int getNumChild() { result = count(this.getAChild()) }
|
int getNumChild() { result = count(this.getAChild()) }
|
||||||
@@ -38,14 +38,14 @@ class Expr extends StmtParent, @expr {
|
|||||||
Expr getAChild() { exists (int n | result = this.getChild(n)) }
|
Expr getAChild() { exists (int n | result = this.getChild(n)) }
|
||||||
|
|
||||||
/** Gets the parent of this expression, if any. */
|
/** Gets the parent of this expression, if any. */
|
||||||
Element getParent() { exprparents(unresolveElement(this),_,unresolveElement(result)) }
|
Element getParent() { exprparents(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets the location of this expression. */
|
/** Gets the location of this expression. */
|
||||||
override Location getLocation() { exprs(unresolveElement(this),_,result) }
|
override Location getLocation() { exprs(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
/** Holds if this is an auxiliary expression generated by the compiler. */
|
/** Holds if this is an auxiliary expression generated by the compiler. */
|
||||||
predicate isCompilerGenerated() {
|
predicate isCompilerGenerated() {
|
||||||
compgenerated(unresolveElement(this)) or
|
compgenerated(underlyingElement(this)) or
|
||||||
this.getParent().(ConstructorFieldInit).isCompilerGenerated()
|
this.getParent().(ConstructorFieldInit).isCompilerGenerated()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
* As the type of an expression can sometimes be a TypedefType, calling getUnderlyingType()
|
* As the type of an expression can sometimes be a TypedefType, calling getUnderlyingType()
|
||||||
* is often more useful than calling this predicate.
|
* is often more useful than calling this predicate.
|
||||||
*/
|
*/
|
||||||
pragma[nomagic] Type getType() { expr_types(unresolveElement(this),unresolveElement(result),_) }
|
pragma[nomagic] Type getType() { expr_types(underlyingElement(this),unresolveElement(result),_) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of this expression after typedefs have been resolved.
|
* Gets the type of this expression after typedefs have been resolved.
|
||||||
@@ -71,19 +71,19 @@ class Expr extends StmtParent, @expr {
|
|||||||
*
|
*
|
||||||
* Consider using subclasses of `Expr` rather than relying on this predicate.
|
* Consider using subclasses of `Expr` rather than relying on this predicate.
|
||||||
*/
|
*/
|
||||||
int getKind() { exprs(unresolveElement(this),result,_) }
|
int getKind() { exprs(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
/** Gets a textual representation of this expression. */
|
/** Gets a textual representation of this expression. */
|
||||||
override string toString() { none() }
|
override string toString() { none() }
|
||||||
|
|
||||||
/** Gets the value of this expression, if it is a constant. */
|
/** Gets the value of this expression, if it is a constant. */
|
||||||
string getValue() { exists(@value v | values(v,result,_) and valuebind(v,unresolveElement(this))) }
|
string getValue() { exists(@value v | values(v,result,_) and valuebind(v,underlyingElement(this))) }
|
||||||
|
|
||||||
/** Gets the source text for the value of this expression, if it is a constant. */
|
/** Gets the source text for the value of this expression, if it is a constant. */
|
||||||
string getValueText() { exists(@value v | values(v,_,result) and valuebind(v,unresolveElement(this))) }
|
string getValueText() { exists(@value v | values(v,_,result) and valuebind(v,underlyingElement(this))) }
|
||||||
|
|
||||||
/** Holds if this expression has a value that can be determined at compile time. */
|
/** Holds if this expression has a value that can be determined at compile time. */
|
||||||
predicate isConstant() { valuebind(_,unresolveElement(this)) }
|
predicate isConstant() { valuebind(_,underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this expression is side-effect free (conservative
|
* Holds if this expression is side-effect free (conservative
|
||||||
@@ -124,7 +124,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
* See [basic.lval] for more about lvalues.
|
* See [basic.lval] for more about lvalues.
|
||||||
*/
|
*/
|
||||||
predicate isLValueCategory() {
|
predicate isLValueCategory() {
|
||||||
expr_types(unresolveElement(this), _, 3)
|
expr_types(underlyingElement(this), _, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,7 +134,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
* See [basic.lval] for more about xvalues.
|
* See [basic.lval] for more about xvalues.
|
||||||
*/
|
*/
|
||||||
predicate isXValueCategory() {
|
predicate isXValueCategory() {
|
||||||
expr_types(unresolveElement(this), _, 2)
|
expr_types(underlyingElement(this), _, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +143,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
* See [basic.lval] for more about prvalues.
|
* See [basic.lval] for more about prvalues.
|
||||||
*/
|
*/
|
||||||
predicate isPRValueCategory() {
|
predicate isPRValueCategory() {
|
||||||
expr_types(unresolveElement(this), _, 1)
|
expr_types(underlyingElement(this), _, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +234,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
* See [conv.lval] for more about the lvalue-to-rvalue conversion
|
* See [conv.lval] for more about the lvalue-to-rvalue conversion
|
||||||
*/
|
*/
|
||||||
predicate hasLValueToRValueConversion() {
|
predicate hasLValueToRValueConversion() {
|
||||||
expr_isload(unresolveElement(this))
|
expr_isload(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -303,14 +303,14 @@ class Expr extends StmtParent, @expr {
|
|||||||
* and 1 has a bool conversion, while the bool conversion itself has
|
* and 1 has a bool conversion, while the bool conversion itself has
|
||||||
* an int conversion.
|
* an int conversion.
|
||||||
*/
|
*/
|
||||||
predicate hasConversion() { exists(Expr e | exprconv(unresolveElement(this),unresolveElement(e))) }
|
predicate hasConversion() { exists(Expr e | exprconv(underlyingElement(this),unresolveElement(e))) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this expression has an implicit conversion.
|
* Holds if this expression has an implicit conversion.
|
||||||
*
|
*
|
||||||
* For example in `char *str = 0`, the `0` has an implicit conversion to type `char *`.
|
* For example in `char *str = 0`, the `0` has an implicit conversion to type `char *`.
|
||||||
*/
|
*/
|
||||||
predicate hasImplicitConversion() { exists(Expr e | exprconv(unresolveElement(this),unresolveElement(e)) and e.(Cast).isImplicit()) }
|
predicate hasImplicitConversion() { exists(Expr e | exprconv(underlyingElement(this),unresolveElement(e)) and e.(Cast).isImplicit()) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this expression has an explicit conversion.
|
* Holds if this expression has an explicit conversion.
|
||||||
@@ -318,12 +318,12 @@ class Expr extends StmtParent, @expr {
|
|||||||
* For example in `(MyClass *)ptr`, the `ptr` has an explicit
|
* For example in `(MyClass *)ptr`, the `ptr` has an explicit
|
||||||
* conversion to type `MyClass *`.
|
* conversion to type `MyClass *`.
|
||||||
*/
|
*/
|
||||||
predicate hasExplicitConversion() { exists(Expr e | exprconv(unresolveElement(this),unresolveElement(e)) and not e.(Cast).isImplicit()) }
|
predicate hasExplicitConversion() { exists(Expr e | exprconv(underlyingElement(this),unresolveElement(e)) and not e.(Cast).isImplicit()) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conversion associated with this expression, if any.
|
* Gets the conversion associated with this expression, if any.
|
||||||
*/
|
*/
|
||||||
Expr getConversion() { exprconv(unresolveElement(this),unresolveElement(result)) }
|
Expr getConversion() { exprconv(underlyingElement(this),unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string describing the conversion associated with this expression,
|
* Gets a string describing the conversion associated with this expression,
|
||||||
@@ -594,14 +594,14 @@ class NewExpr extends Expr, @new_expr {
|
|||||||
* For example, for `new int` the result is `int`.
|
* For example, for `new int` the result is `int`.
|
||||||
*/
|
*/
|
||||||
Type getAllocatedType() {
|
Type getAllocatedType() {
|
||||||
new_allocated_type(unresolveElement(this), unresolveElement(result))
|
new_allocated_type(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the `operator new` that allocates storage.
|
* Gets the `operator new` that allocates storage.
|
||||||
*/
|
*/
|
||||||
Function getAllocator() {
|
Function getAllocator() {
|
||||||
expr_allocator(unresolveElement(this), unresolveElement(result), _)
|
expr_allocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -609,7 +609,7 @@ class NewExpr extends Expr, @new_expr {
|
|||||||
* argument of type `std::align_val_t`.
|
* argument of type `std::align_val_t`.
|
||||||
*/
|
*/
|
||||||
predicate hasAlignedAllocation() {
|
predicate hasAlignedAllocation() {
|
||||||
expr_allocator(unresolveElement(this), _, 1)
|
expr_allocator(underlyingElement(this), _, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -629,7 +629,7 @@ class NewExpr extends Expr, @new_expr {
|
|||||||
* throws an exception, if any.
|
* throws an exception, if any.
|
||||||
*/
|
*/
|
||||||
Function getDeallocator() {
|
Function getDeallocator() {
|
||||||
expr_deallocator(unresolveElement(this), unresolveElement(result), _)
|
expr_deallocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -637,7 +637,7 @@ class NewExpr extends Expr, @new_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasSizedDeallocation() {
|
predicate hasSizedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ class NewExpr extends Expr, @new_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasAlignedDeallocation() {
|
predicate hasAlignedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -675,7 +675,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
* For example, for `new int[5]` the result is `int[5]`.
|
* For example, for `new int[5]` the result is `int[5]`.
|
||||||
*/
|
*/
|
||||||
Type getAllocatedType() {
|
Type getAllocatedType() {
|
||||||
new_array_allocated_type(unresolveElement(this), unresolveElement(result))
|
new_array_allocated_type(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -689,7 +689,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
* Gets the `operator new[]` that allocates storage.
|
* Gets the `operator new[]` that allocates storage.
|
||||||
*/
|
*/
|
||||||
Function getAllocator() {
|
Function getAllocator() {
|
||||||
expr_allocator(unresolveElement(this), unresolveElement(result), _)
|
expr_allocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -697,7 +697,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
* argument of type `std::align_val_t`.
|
* argument of type `std::align_val_t`.
|
||||||
*/
|
*/
|
||||||
predicate hasAlignedAllocation() {
|
predicate hasAlignedAllocation() {
|
||||||
expr_allocator(unresolveElement(this), _, 1)
|
expr_allocator(underlyingElement(this), _, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -712,7 +712,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
* throws an exception, if any.
|
* throws an exception, if any.
|
||||||
*/
|
*/
|
||||||
Function getDeallocator() {
|
Function getDeallocator() {
|
||||||
expr_deallocator(unresolveElement(this), unresolveElement(result), _)
|
expr_deallocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -720,7 +720,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasSizedDeallocation() {
|
predicate hasSizedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ class NewArrayExpr extends Expr, @new_array_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasAlignedDeallocation() {
|
predicate hasAlignedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -788,7 +788,7 @@ class DeleteExpr extends Expr, @delete_expr {
|
|||||||
* dynamic type of the object.
|
* dynamic type of the object.
|
||||||
*/
|
*/
|
||||||
Function getDeallocator() {
|
Function getDeallocator() {
|
||||||
expr_deallocator(unresolveElement(this), unresolveElement(result), _)
|
expr_deallocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -796,7 +796,7 @@ class DeleteExpr extends Expr, @delete_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasSizedDeallocation() {
|
predicate hasSizedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -806,7 +806,7 @@ class DeleteExpr extends Expr, @delete_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasAlignedDeallocation() {
|
predicate hasAlignedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -856,7 +856,7 @@ class DeleteArrayExpr extends Expr, @delete_array_expr {
|
|||||||
* Gets the `operator delete[]` that deallocates storage.
|
* Gets the `operator delete[]` that deallocates storage.
|
||||||
*/
|
*/
|
||||||
Function getDeallocator() {
|
Function getDeallocator() {
|
||||||
expr_deallocator(unresolveElement(this), unresolveElement(result), _)
|
expr_deallocator(underlyingElement(this), unresolveElement(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -864,7 +864,7 @@ class DeleteArrayExpr extends Expr, @delete_array_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasSizedDeallocation() {
|
predicate hasSizedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
form.bitAnd(1) != 0 // Bit zero is the "size" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -874,7 +874,7 @@ class DeleteArrayExpr extends Expr, @delete_array_expr {
|
|||||||
*/
|
*/
|
||||||
predicate hasAlignedDeallocation() {
|
predicate hasAlignedDeallocation() {
|
||||||
exists(int form |
|
exists(int form |
|
||||||
expr_deallocator(unresolveElement(this), _, form) and
|
expr_deallocator(underlyingElement(this), _, form) and
|
||||||
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
form.bitAnd(2) != 0 // Bit one is the "alignment" bit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -944,7 +944,7 @@ class ThisExpr extends Expr, @thisaccess {
|
|||||||
*/
|
*/
|
||||||
class BlockExpr extends Literal {
|
class BlockExpr extends Literal {
|
||||||
BlockExpr() {
|
BlockExpr() {
|
||||||
code_block(unresolveElement(this), _)
|
code_block(underlyingElement(this), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override string toString() { result = "^ { ... }" }
|
override string toString() { result = "^ { ... }" }
|
||||||
@@ -953,7 +953,7 @@ class BlockExpr extends Literal {
|
|||||||
* Gets the (anonymous) function associated with this code block expression.
|
* Gets the (anonymous) function associated with this code block expression.
|
||||||
*/
|
*/
|
||||||
Function getFunction() {
|
Function getFunction() {
|
||||||
code_block(unresolveElement(this), unresolveElement(result))
|
code_block(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class LambdaExpression extends Expr, @lambdaexpr {
|
|||||||
* Gets the nth implicitly or explicitly captured value of this lambda expression.
|
* Gets the nth implicitly or explicitly captured value of this lambda expression.
|
||||||
*/
|
*/
|
||||||
LambdaCapture getCapture(int index) {
|
LambdaCapture getCapture(int index) {
|
||||||
lambda_capture(result, unresolveElement(this), index, _, _, _)
|
lambda_capture(result, underlyingElement(this), index, _, _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,14 +34,14 @@ class LambdaExpression extends Expr, @lambdaexpr {
|
|||||||
* - "=" if capture-by-value is the default for implicit captures.
|
* - "=" if capture-by-value is the default for implicit captures.
|
||||||
*/
|
*/
|
||||||
string getDefaultCaptureMode() {
|
string getDefaultCaptureMode() {
|
||||||
lambdas(unresolveElement(this), result, _)
|
lambdas(underlyingElement(this), result, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if the return type (of the call operator of the resulting object) was explicitly specified.
|
* Holds if the return type (of the call operator of the resulting object) was explicitly specified.
|
||||||
*/
|
*/
|
||||||
predicate returnTypeIsExplicit() {
|
predicate returnTypeIsExplicit() {
|
||||||
lambdas(unresolveElement(this), _, true)
|
lambdas(underlyingElement(this), _, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ class Literal extends Expr, @literal {
|
|||||||
*/
|
*/
|
||||||
class LabelLiteral extends Literal {
|
class LabelLiteral extends Literal {
|
||||||
LabelLiteral() {
|
LabelLiteral() {
|
||||||
jumpinfo(unresolveElement(this),_,_)
|
jumpinfo(underlyingElement(this),_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the corresponding label statement. */
|
/** Gets the corresponding label statement. */
|
||||||
LabelStmt getLabel() {
|
LabelStmt getLabel() {
|
||||||
jumpinfo(unresolveElement(this),_,unresolveElement(result))
|
jumpinfo(underlyingElement(this),_,unresolveElement(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,17 +22,17 @@ class MetricFile extends File {
|
|||||||
|
|
||||||
/** Gets the number of lines in this file. */
|
/** Gets the number of lines in this file. */
|
||||||
int getNumberOfLines() {
|
int getNumberOfLines() {
|
||||||
numlines(unresolveElement(this),result,_,_)
|
numlines(underlyingElement(this),result,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of lines of code in this file. */
|
/** Gets the number of lines of code in this file. */
|
||||||
int getNumberOfLinesOfCode() {
|
int getNumberOfLinesOfCode() {
|
||||||
numlines(unresolveElement(this),_,result,_)
|
numlines(underlyingElement(this),_,result,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of lines of comments in this file. */
|
/** Gets the number of lines of comments in this file. */
|
||||||
int getNumberOfLinesOfComments() {
|
int getNumberOfLinesOfComments() {
|
||||||
numlines(unresolveElement(this),_,_,result)
|
numlines(underlyingElement(this),_,_,result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of incoming file dependencies. */
|
/** Gets the number of incoming file dependencies. */
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ class MetricFunction extends Function {
|
|||||||
|
|
||||||
/** Gets the number of lines in this function. */
|
/** Gets the number of lines in this function. */
|
||||||
int getNumberOfLines() {
|
int getNumberOfLines() {
|
||||||
numlines(unresolveElement(this),result,_,_)
|
numlines(underlyingElement(this),result,_,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of lines of code in this function. */
|
/** Gets the number of lines of code in this function. */
|
||||||
int getNumberOfLinesOfCode() {
|
int getNumberOfLinesOfCode() {
|
||||||
numlines(unresolveElement(this),_,result,_)
|
numlines(underlyingElement(this),_,result,_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the number of lines of comments in this function. */
|
/** Gets the number of lines of comments in this function. */
|
||||||
int getNumberOfLinesOfComments() {
|
int getNumberOfLinesOfComments() {
|
||||||
numlines(unresolveElement(this),_,_,result)
|
numlines(underlyingElement(this),_,_,result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the ratio of lines of comments to total lines in this function (between 0.0 and 1.0). */
|
/** Gets the ratio of lines of comments to total lines in this function (between 0.0 and 1.0). */
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class TargetPointsToExpr extends PointsToExpr {
|
|||||||
{
|
{
|
||||||
exists(int cset, VirtualFunction static |
|
exists(int cset, VirtualFunction static |
|
||||||
this.interesting() and
|
this.interesting() and
|
||||||
parentSetFor(cset, unresolveElement(this)) and
|
parentSetFor(cset, underlyingElement(this)) and
|
||||||
static = this.staticTarget() and
|
static = this.staticTarget() and
|
||||||
childrenByElement(cset, static, result)
|
childrenByElement(cset, static, result)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ class PointsToExpr extends Expr
|
|||||||
pragma[noopt]
|
pragma[noopt]
|
||||||
Element pointsTo()
|
Element pointsTo()
|
||||||
{
|
{
|
||||||
this.interesting() and exists(int set, @element thisEntity, @element resultEntity | thisEntity = unresolveElement(this) and pointstosets(set, thisEntity) and setlocations(set, resultEntity) and resultEntity = unresolveElement(result))
|
this.interesting() and exists(int set, @element thisEntity, @element resultEntity | thisEntity = underlyingElement(this) and pointstosets(set, thisEntity) and setlocations(set, resultEntity) and resultEntity = unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
float confidence() { result = 1.0 / count(this.pointsTo()) }
|
float confidence() { result = 1.0 / count(this.pointsTo()) }
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
|
|
||||||
/** Gets the `n`th child of this statement. */
|
/** Gets the `n`th child of this statement. */
|
||||||
Element getChild(int n) {
|
Element getChild(int n) {
|
||||||
stmtparents(unresolveElement(result),n,unresolveElement(this)) or
|
stmtparents(unresolveElement(result),n,underlyingElement(this)) or
|
||||||
exprparents(unresolveElement(result),n,unresolveElement(this))
|
exprparents(unresolveElement(result),n,underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if `e` is the `n`th child of this statement. */
|
/** Holds if `e` is the `n`th child of this statement. */
|
||||||
@@ -35,10 +35,10 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
Element getAChild() { exists (int n | result = this.getChild(n)) }
|
Element getAChild() { exists (int n | result = this.getChild(n)) }
|
||||||
|
|
||||||
/** Gets the parent of this statement, if any. */
|
/** Gets the parent of this statement, if any. */
|
||||||
StmtParent getParent() { stmtparents(unresolveElement(this),_,unresolveElement(result)) }
|
StmtParent getParent() { stmtparents(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets the parent statement of this statement, if any. */
|
/** Gets the parent statement of this statement, if any. */
|
||||||
Stmt getParentStmt() { stmtparents(unresolveElement(this),_,unresolveElement(result)) }
|
Stmt getParentStmt() { stmtparents(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
|
|
||||||
/** Gets a child statement of this statement. */
|
/** Gets a child statement of this statement. */
|
||||||
Stmt getChildStmt() { result.getParentStmt() = this }
|
Stmt getChildStmt() { result.getParentStmt() = this }
|
||||||
@@ -51,10 +51,10 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
result = b.getStmt(i+1))
|
result = b.getStmt(i+1))
|
||||||
}
|
}
|
||||||
|
|
||||||
override Location getLocation() { stmts(unresolveElement(this),_,result) }
|
override Location getLocation() { stmts(underlyingElement(this),_,result) }
|
||||||
|
|
||||||
/** Gets an int indicating the type of statement that this represents. */
|
/** Gets an int indicating the type of statement that this represents. */
|
||||||
int getKind() { stmts(unresolveElement(this),result,_) }
|
int getKind() { stmts(underlyingElement(this),result,_) }
|
||||||
|
|
||||||
override string toString() { none() }
|
override string toString() { none() }
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
* `[[clang::fallthrough]]`.
|
* `[[clang::fallthrough]]`.
|
||||||
*/
|
*/
|
||||||
Attribute getAnAttribute() {
|
Attribute getAnAttribute() {
|
||||||
stmtattributes(unresolveElement(this), unresolveElement(result))
|
stmtattributes(underlyingElement(this), unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,7 +135,7 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
|
|
||||||
/** Holds if this statement was generated by the compiler. */
|
/** Holds if this statement was generated by the compiler. */
|
||||||
predicate isCompilerGenerated() {
|
predicate isCompilerGenerated() {
|
||||||
compgenerated(unresolveElement(this))
|
compgenerated(underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ class IfStmt extends ConditionalStmt, @stmt_if {
|
|||||||
* ```
|
* ```
|
||||||
* the result is the `Block` `{ x = 1; }`.
|
* the result is the `Block` `{ x = 1; }`.
|
||||||
*/
|
*/
|
||||||
Stmt getThen() { if_then(unresolveElement(this), unresolveElement(result)) }
|
Stmt getThen() { if_then(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the 'else' statement of this 'if' statement, if any.
|
* Gets the 'else' statement of this 'if' statement, if any.
|
||||||
@@ -248,7 +248,7 @@ class IfStmt extends ConditionalStmt, @stmt_if {
|
|||||||
* ```
|
* ```
|
||||||
* there is no result.
|
* there is no result.
|
||||||
*/
|
*/
|
||||||
Stmt getElse() { if_else(unresolveElement(this), unresolveElement(result)) }
|
Stmt getElse() { if_else(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this 'if' statement has an 'else' statement.
|
* Holds if this 'if' statement has an 'else' statement.
|
||||||
@@ -306,7 +306,7 @@ abstract class Loop extends ControlStructure {
|
|||||||
class WhileStmt extends Loop, @stmt_while {
|
class WhileStmt extends Loop, @stmt_while {
|
||||||
override Expr getCondition() { result = this.getChild(0) }
|
override Expr getCondition() { result = this.getChild(0) }
|
||||||
override Expr getControllingExpr() { result = this.getCondition() }
|
override Expr getControllingExpr() { result = this.getCondition() }
|
||||||
override Stmt getStmt() { while_body(unresolveElement(this), unresolveElement(result)) }
|
override Stmt getStmt() { while_body(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
override string toString() { result = "while (...) ..." }
|
override string toString() { result = "while (...) ..." }
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ class WhileStmt extends Loop, @stmt_while {
|
|||||||
abstract class JumpStmt extends Stmt, @jump {
|
abstract class JumpStmt extends Stmt, @jump {
|
||||||
|
|
||||||
/** Gets the target of this jump statement. */
|
/** Gets the target of this jump statement. */
|
||||||
Stmt getTarget() { jumpinfo(unresolveElement(this),_,unresolveElement(result)) }
|
Stmt getTarget() { jumpinfo(underlyingElement(this),_,unresolveElement(result)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -393,10 +393,10 @@ class GotoStmt extends JumpStmt, @stmt_goto {
|
|||||||
* ```
|
* ```
|
||||||
* the result is `"someLabel"`.
|
* the result is `"someLabel"`.
|
||||||
*/
|
*/
|
||||||
string getName() { jumpinfo(unresolveElement(this),result,_) and result != "" }
|
string getName() { jumpinfo(underlyingElement(this),result,_) and result != "" }
|
||||||
|
|
||||||
/** Holds if this 'goto' statement refers to a label. */
|
/** Holds if this 'goto' statement refers to a label. */
|
||||||
predicate hasName() { exists(string s | jumpinfo(unresolveElement(this),s,_) and s != "") }
|
predicate hasName() { exists(string s | jumpinfo(underlyingElement(this),s,_) and s != "") }
|
||||||
|
|
||||||
override string toString() { result = "goto ..." }
|
override string toString() { result = "goto ..." }
|
||||||
|
|
||||||
@@ -534,7 +534,7 @@ private Stmt getEnclosingBreakable(Stmt s) {
|
|||||||
class LabelStmt extends Stmt, @stmt_label {
|
class LabelStmt extends Stmt, @stmt_label {
|
||||||
|
|
||||||
/** Gets the name of this 'label' statement. */
|
/** Gets the name of this 'label' statement. */
|
||||||
string getName() { jumpinfo(unresolveElement(this),result,_) and result != "" }
|
string getName() { jumpinfo(underlyingElement(this),result,_) and result != "" }
|
||||||
|
|
||||||
/** Holds if this 'label' statement is named. */
|
/** Holds if this 'label' statement is named. */
|
||||||
predicate isNamed() { exists(this.getName()) }
|
predicate isNamed() { exists(this.getName()) }
|
||||||
@@ -611,7 +611,7 @@ class DoStmt extends Loop, @stmt_end_test_while {
|
|||||||
|
|
||||||
override Expr getCondition() { result = this.getChild(0) }
|
override Expr getCondition() { result = this.getChild(0) }
|
||||||
override Expr getControllingExpr() { result = this.getCondition() }
|
override Expr getControllingExpr() { result = this.getCondition() }
|
||||||
override Stmt getStmt() { do_body(unresolveElement(this), unresolveElement(result)) }
|
override Stmt getStmt() { do_body(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
override string toString() { result = "do (...) ..." }
|
override string toString() { result = "do (...) ..." }
|
||||||
|
|
||||||
@@ -743,7 +743,7 @@ class ForStmt extends Loop, @stmt_for {
|
|||||||
* for (; i < 10; i++) { j++ }
|
* for (; i < 10; i++) { j++ }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
Stmt getInitialization() { for_initialization(unresolveElement(this), unresolveElement(result)) }
|
Stmt getInitialization() { for_initialization(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the condition expression of this 'for' statement.
|
* Gets the condition expression of this 'for' statement.
|
||||||
@@ -759,7 +759,7 @@ class ForStmt extends Loop, @stmt_for {
|
|||||||
* for (i = 0;; i++) { if (i >= 10) break; }
|
* for (i = 0;; i++) { if (i >= 10) break; }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
override Expr getCondition() { for_condition(unresolveElement(this), unresolveElement(result)) }
|
override Expr getCondition() { for_condition(underlyingElement(this), unresolveElement(result)) }
|
||||||
override Expr getControllingExpr() { result = this.getCondition() }
|
override Expr getControllingExpr() { result = this.getCondition() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -776,9 +776,9 @@ class ForStmt extends Loop, @stmt_for {
|
|||||||
* for (i = 0; i < 10;) { i++; }
|
* for (i = 0; i < 10;) { i++; }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
Expr getUpdate() { for_update(unresolveElement(this), unresolveElement(result)) }
|
Expr getUpdate() { for_update(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
override Stmt getStmt() { for_body(unresolveElement(this), unresolveElement(result)) }
|
override Stmt getStmt() { for_body(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
override string toString() { result = "for(...;...;...) ..." }
|
override string toString() { result = "for(...;...;...) ..." }
|
||||||
|
|
||||||
@@ -1026,7 +1026,7 @@ class SwitchCase extends Stmt, @stmt_switch_case {
|
|||||||
* has result 2.
|
* has result 2.
|
||||||
*/
|
*/
|
||||||
int getChildNum() {
|
int getChildNum() {
|
||||||
switch_case(_, result, unresolveElement(this))
|
switch_case(_, result, underlyingElement(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1360,7 +1360,7 @@ class SwitchStmt extends ConditionalStmt, @stmt_switch {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
Stmt getStmt() { switch_body(unresolveElement(this), unresolveElement(result)) }
|
Stmt getStmt() { switch_body(underlyingElement(this), unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a 'switch case' statement of this 'switch' statement.
|
* Gets a 'switch case' statement of this 'switch' statement.
|
||||||
@@ -1377,7 +1377,7 @@ class SwitchStmt extends ConditionalStmt, @stmt_switch {
|
|||||||
* ```
|
* ```
|
||||||
* the results are `case 1:`, `case 2:` and `default:`.
|
* the results are `case 1:`, `case 2:` and `default:`.
|
||||||
*/
|
*/
|
||||||
SwitchCase getASwitchCase() { switch_case(unresolveElement(this), _, unresolveElement(result)) }
|
SwitchCase getASwitchCase() { switch_case(underlyingElement(this), _, unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the 'default case' statement of this 'switch' statement,
|
* Gets the 'default case' statement of this 'switch' statement,
|
||||||
@@ -1662,7 +1662,7 @@ class FunctionTryStmt extends TryStmt {
|
|||||||
* A 'catch block', from either C++'s `catch` or Objective C's `@catch`.
|
* A 'catch block', from either C++'s `catch` or Objective C's `@catch`.
|
||||||
*/
|
*/
|
||||||
class CatchBlock extends Block {
|
class CatchBlock extends Block {
|
||||||
CatchBlock() { ishandler(unresolveElement(this)) }
|
CatchBlock() { ishandler(underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parameter introduced by this 'catch block', if any.
|
* Gets the parameter introduced by this 'catch block', if any.
|
||||||
@@ -1752,7 +1752,7 @@ class DeclStmt extends Stmt, @stmt_decl {
|
|||||||
* the result of `getDeclarationEntry(0)` is `i`.
|
* the result of `getDeclarationEntry(0)` is `i`.
|
||||||
*/
|
*/
|
||||||
DeclarationEntry getDeclarationEntry(int i) {
|
DeclarationEntry getDeclarationEntry(int i) {
|
||||||
stmt_decl_entry_bind(unresolveElement(this), i, unresolveElement(result))
|
stmt_decl_entry_bind(underlyingElement(this), i, unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1788,7 +1788,7 @@ class DeclStmt extends Stmt, @stmt_decl {
|
|||||||
* ```
|
* ```
|
||||||
* the result of `getDeclaration(0)` is `i`.
|
* the result of `getDeclaration(0)` is `i`.
|
||||||
*/
|
*/
|
||||||
Declaration getDeclaration(int i) { stmt_decl_bind(unresolveElement(this), i, unresolveElement(result)) }
|
Declaration getDeclaration(int i) { stmt_decl_bind(underlyingElement(this), i, unresolveElement(result)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a declaration declared by this 'declaration' statement.
|
* Gets a declaration declared by this 'declaration' statement.
|
||||||
@@ -1891,11 +1891,11 @@ class VlaDeclStmt extends Stmt, @stmt_vla_decl {
|
|||||||
* Gets the type that this VLA declaration statement relates to,
|
* Gets the type that this VLA declaration statement relates to,
|
||||||
* if any.
|
* if any.
|
||||||
*/
|
*/
|
||||||
Type getType() { type_vla(unresolveElement(result), unresolveElement(this)) }
|
Type getType() { type_vla(unresolveElement(result), underlyingElement(this)) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the variable that this VLA declaration statement relates to,
|
* Gets the variable that this VLA declaration statement relates to,
|
||||||
* if any.
|
* if any.
|
||||||
*/
|
*/
|
||||||
Variable getVariable() { variable_vla(unresolveElement(result), unresolveElement(this)) }
|
Variable getVariable() { variable_vla(unresolveElement(result), underlyingElement(this)) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user