mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++/C#: Fix some duplicate IRType problems, and add a sanity test
This commit is contained in:
@@ -248,4 +248,14 @@ module IRTypeSanity {
|
||||
strictcount(type.getCanonicalLanguageType()) > 1 and
|
||||
message = "Type has multiple canonical `LanguageType`s: " + concat(type.getCanonicalLanguageType().toString(), ", ")
|
||||
}
|
||||
|
||||
query predicate missingIRType(Language::LanguageType type, string message) {
|
||||
not exists(type.getIRType()) and
|
||||
message = "`LanguageType` does not have a corresponding `IRType`."
|
||||
}
|
||||
|
||||
query predicate multipleIRTypes(Language::LanguageType type, string message) {
|
||||
strictcount(type.getIRType()) > 1 and
|
||||
message = "`LanguageType` " + type.getAQlClass() + " has multiple `IRType`s: " + concat(type.getIRType().toString(), ", ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ private class CppUnknownOpaqueType extends CppType, TUnknownOpaqueType {
|
||||
}
|
||||
|
||||
override final IROpaqueType getIRType() {
|
||||
result.getByteSize() = byteSize
|
||||
result.getByteSize() = byteSize and result.getTag() instanceof UnknownType
|
||||
}
|
||||
|
||||
override predicate hasType(Type type, boolean isGLValue) {
|
||||
|
||||
@@ -15,3 +15,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -15,3 +15,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -15,3 +15,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -15,3 +15,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -15,3 +15,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -546,3 +546,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -694,3 +694,5 @@ useNotDominatedByDefinition
|
||||
| vla.c:14:74:14:79 | Operand | Operand 'Operand' is not dominated by its definition in function '$@'. | vla.c:11:6:11:16 | IR: vla_typedef | void vla_typedef() |
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -555,3 +555,5 @@ backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
Reference in New Issue
Block a user