Skip to content

Commit e5bd668

Browse files
author
Dave Bartolomeo
committed
C++/C#: Add QLDoc for renamed queries
1 parent 3987267 commit e5bd668

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

cpp/ql/src/semmle/code/cpp/exprs/Cast.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,29 @@ class Cast extends Conversion, @cast {
5252
* run "semmle/code/cpp/ASTConsistency.ql".
5353
*/
5454
module CastConsistency {
55+
/**
56+
* Holds if the cast has more than one result for `Cast.getSemanticConversionString()`.
57+
*/
5558
query predicate multipleSemanticConversionStrings(Cast cast, Type fromType, string kind) {
5659
// Every cast should have exactly one semantic conversion kind
5760
count(cast.getSemanticConversionString()) > 1 and
5861
kind = cast.getSemanticConversionString() and
5962
fromType = cast.getExpr().getUnspecifiedType()
6063
}
6164

65+
/**
66+
* Holds if the cast has no result for `Cast.getSemanticConversionString()`.
67+
*/
6268
query predicate missingSemanticConversionString(Cast cast, Type fromType) {
6369
// Every cast should have exactly one semantic conversion kind
6470
not exists(cast.getSemanticConversionString()) and
6571
fromType = cast.getExpr().getUnspecifiedType()
6672
}
6773

74+
/**
75+
* Holds if the cast has a result for `Cast.getSemanticConversionString()` that indicates that the
76+
* kind of its semantic conversion is not known.
77+
*/
6878
query predicate unknownSemanticConversionString(Cast cast, Type fromType) {
6979
// Every cast should have a known semantic conversion kind
7080
cast.getSemanticConversionString() = "unknown conversion" and

cpp/ql/src/semmle/code/cpp/ir/implementation/IRType.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,42 @@ class IROpaqueType extends IRSizedType, TIROpaqueType {
275275
final override int getByteSize() { result = byteSize }
276276
}
277277

278+
/**
279+
* INTERNAL: Do not use.
280+
* Query predicates used to check invariants that should hold for all `IRType` objects. To run all
281+
* consistency queries for the IR, including the ones below, run
282+
* "semmle/code/cpp/IR/IRConsistency.ql".
283+
*/
278284
module IRTypeConsistency {
285+
/**
286+
* Holds if the type has no result for `IRType.getCanonicalLanguageType()`.
287+
*/
279288
query predicate missingCanonicalLanguageType(IRType type, string message) {
280289
not exists(type.getCanonicalLanguageType()) and
281290
message = "Type does not have a canonical `LanguageType`"
282291
}
283292

293+
/**
294+
* Holds if the type has more than one result for `IRType.getCanonicalLanguageType()`.
295+
*/
284296
query predicate multipleCanonicalLanguageTypes(IRType type, string message) {
285297
strictcount(type.getCanonicalLanguageType()) > 1 and
286298
message =
287299
"Type has multiple canonical `LanguageType`s: " +
288300
concat(type.getCanonicalLanguageType().toString(), ", ")
289301
}
290302

303+
/**
304+
* Holds if the type has no result for `LanguageType.getIRType()`.
305+
*/
291306
query predicate missingIRType(Language::LanguageType type, string message) {
292307
not exists(type.getIRType()) and
293308
message = "`LanguageType` does not have a corresponding `IRType`."
294309
}
295310

311+
/**
312+
* Holds if the type has more than one result for `LanguageType.getIRType()`.
313+
*/
296314
query predicate multipleIRTypes(Language::LanguageType type, string message) {
297315
strictcount(type.getIRType()) > 1 and
298316
message =

csharp/ql/src/semmle/code/csharp/ir/implementation/IRType.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,42 @@ class IROpaqueType extends IRSizedType, TIROpaqueType {
275275
final override int getByteSize() { result = byteSize }
276276
}
277277

278+
/**
279+
* INTERNAL: Do not use.
280+
* Query predicates used to check invariants that should hold for all `IRType` objects. To run all
281+
* consistency queries for the IR, including the ones below, run
282+
* "semmle/code/cpp/IR/IRConsistency.ql".
283+
*/
278284
module IRTypeConsistency {
285+
/**
286+
* Holds if the type has no result for `IRType.getCanonicalLanguageType()`.
287+
*/
279288
query predicate missingCanonicalLanguageType(IRType type, string message) {
280289
not exists(type.getCanonicalLanguageType()) and
281290
message = "Type does not have a canonical `LanguageType`"
282291
}
283292

293+
/**
294+
* Holds if the type has more than one result for `IRType.getCanonicalLanguageType()`.
295+
*/
284296
query predicate multipleCanonicalLanguageTypes(IRType type, string message) {
285297
strictcount(type.getCanonicalLanguageType()) > 1 and
286298
message =
287299
"Type has multiple canonical `LanguageType`s: " +
288300
concat(type.getCanonicalLanguageType().toString(), ", ")
289301
}
290302

303+
/**
304+
* Holds if the type has no result for `LanguageType.getIRType()`.
305+
*/
291306
query predicate missingIRType(Language::LanguageType type, string message) {
292307
not exists(type.getIRType()) and
293308
message = "`LanguageType` does not have a corresponding `IRType`."
294309
}
295310

311+
/**
312+
* Holds if the type has more than one result for `LanguageType.getIRType()`.
313+
*/
296314
query predicate multipleIRTypes(Language::LanguageType type, string message) {
297315
strictcount(type.getIRType()) > 1 and
298316
message =

0 commit comments

Comments
 (0)