mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++/C#: Add QLDoc for renamed queries
This commit is contained in:
@@ -52,6 +52,9 @@ class Cast extends Conversion, @cast {
|
||||
* run "semmle/code/cpp/ASTConsistency.ql".
|
||||
*/
|
||||
module CastConsistency {
|
||||
/**
|
||||
* Holds if the cast has more than one result for `Cast.getSemanticConversionString()`.
|
||||
*/
|
||||
query predicate multipleSemanticConversionStrings(Cast cast, Type fromType, string kind) {
|
||||
// Every cast should have exactly one semantic conversion kind
|
||||
count(cast.getSemanticConversionString()) > 1 and
|
||||
@@ -59,12 +62,19 @@ module CastConsistency {
|
||||
fromType = cast.getExpr().getUnspecifiedType()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the cast has no result for `Cast.getSemanticConversionString()`.
|
||||
*/
|
||||
query predicate missingSemanticConversionString(Cast cast, Type fromType) {
|
||||
// Every cast should have exactly one semantic conversion kind
|
||||
not exists(cast.getSemanticConversionString()) and
|
||||
fromType = cast.getExpr().getUnspecifiedType()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the cast has a result for `Cast.getSemanticConversionString()` that indicates that the
|
||||
* kind of its semantic conversion is not known.
|
||||
*/
|
||||
query predicate unknownSemanticConversionString(Cast cast, Type fromType) {
|
||||
// Every cast should have a known semantic conversion kind
|
||||
cast.getSemanticConversionString() = "unknown conversion" and
|
||||
|
||||
@@ -275,12 +275,24 @@ class IROpaqueType extends IRSizedType, TIROpaqueType {
|
||||
final override int getByteSize() { result = byteSize }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Query predicates used to check invariants that should hold for all `IRType` objects. To run all
|
||||
* consistency queries for the IR, including the ones below, run
|
||||
* "semmle/code/cpp/IR/IRConsistency.ql".
|
||||
*/
|
||||
module IRTypeConsistency {
|
||||
/**
|
||||
* Holds if the type has no result for `IRType.getCanonicalLanguageType()`.
|
||||
*/
|
||||
query predicate missingCanonicalLanguageType(IRType type, string message) {
|
||||
not exists(type.getCanonicalLanguageType()) and
|
||||
message = "Type does not have a canonical `LanguageType`"
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has more than one result for `IRType.getCanonicalLanguageType()`.
|
||||
*/
|
||||
query predicate multipleCanonicalLanguageTypes(IRType type, string message) {
|
||||
strictcount(type.getCanonicalLanguageType()) > 1 and
|
||||
message =
|
||||
@@ -288,11 +300,17 @@ module IRTypeConsistency {
|
||||
concat(type.getCanonicalLanguageType().toString(), ", ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has no result for `LanguageType.getIRType()`.
|
||||
*/
|
||||
query predicate missingIRType(Language::LanguageType type, string message) {
|
||||
not exists(type.getIRType()) and
|
||||
message = "`LanguageType` does not have a corresponding `IRType`."
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has more than one result for `LanguageType.getIRType()`.
|
||||
*/
|
||||
query predicate multipleIRTypes(Language::LanguageType type, string message) {
|
||||
strictcount(type.getIRType()) > 1 and
|
||||
message =
|
||||
|
||||
@@ -275,12 +275,24 @@ class IROpaqueType extends IRSizedType, TIROpaqueType {
|
||||
final override int getByteSize() { result = byteSize }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Query predicates used to check invariants that should hold for all `IRType` objects. To run all
|
||||
* consistency queries for the IR, including the ones below, run
|
||||
* "semmle/code/cpp/IR/IRConsistency.ql".
|
||||
*/
|
||||
module IRTypeConsistency {
|
||||
/**
|
||||
* Holds if the type has no result for `IRType.getCanonicalLanguageType()`.
|
||||
*/
|
||||
query predicate missingCanonicalLanguageType(IRType type, string message) {
|
||||
not exists(type.getCanonicalLanguageType()) and
|
||||
message = "Type does not have a canonical `LanguageType`"
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has more than one result for `IRType.getCanonicalLanguageType()`.
|
||||
*/
|
||||
query predicate multipleCanonicalLanguageTypes(IRType type, string message) {
|
||||
strictcount(type.getCanonicalLanguageType()) > 1 and
|
||||
message =
|
||||
@@ -288,11 +300,17 @@ module IRTypeConsistency {
|
||||
concat(type.getCanonicalLanguageType().toString(), ", ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has no result for `LanguageType.getIRType()`.
|
||||
*/
|
||||
query predicate missingIRType(Language::LanguageType type, string message) {
|
||||
not exists(type.getIRType()) and
|
||||
message = "`LanguageType` does not have a corresponding `IRType`."
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the type has more than one result for `LanguageType.getIRType()`.
|
||||
*/
|
||||
query predicate multipleIRTypes(Language::LanguageType type, string message) {
|
||||
strictcount(type.getIRType()) > 1 and
|
||||
message =
|
||||
|
||||
Reference in New Issue
Block a user