mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
more maintainable pattern for class abstractions
This commit is contained in:
@@ -73,60 +73,38 @@ private class IntegralUnderlyingUserType extends UserType {
|
||||
/**
|
||||
* A C/C++ fixed-width numeric type, such as `int8_t`.
|
||||
*/
|
||||
class FixedWidthIntegralType extends UserType {
|
||||
FixedWidthIntegralType() {
|
||||
this instanceof Int8_t or
|
||||
this instanceof Int16_t or
|
||||
this instanceof Int32_t or
|
||||
this instanceof Int64_t or
|
||||
this instanceof UInt8_t or
|
||||
this instanceof UInt16_t or
|
||||
this instanceof UInt32_t or
|
||||
this instanceof UInt64_t
|
||||
}
|
||||
abstract private class TFixedWidthIntegralType extends IntegralUnderlyingUserType { }
|
||||
|
||||
class FixedWidthIntegralType extends TFixedWidthIntegralType {
|
||||
FixedWidthIntegralType() { this instanceof TFixedWidthIntegralType }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C/C++ minimum-width numeric type, such as `int_least8_t`.
|
||||
*/
|
||||
class MinimumWidthIntegralType extends UserType {
|
||||
MinimumWidthIntegralType() {
|
||||
this instanceof Int_least8_t or
|
||||
this instanceof Int_least16_t or
|
||||
this instanceof Int_least32_t or
|
||||
this instanceof Int_least64_t or
|
||||
this instanceof UInt_least8_t or
|
||||
this instanceof UInt_least16_t or
|
||||
this instanceof UInt_least32_t or
|
||||
this instanceof UInt_least64_t
|
||||
}
|
||||
abstract private class TMinimumWidthIntegralType extends IntegralUnderlyingUserType { }
|
||||
|
||||
class MinimumWidthIntegralType extends TMinimumWidthIntegralType {
|
||||
MinimumWidthIntegralType() { this instanceof TMinimumWidthIntegralType }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C/C++ minimum-width numeric type, representing the fastest integer type with a
|
||||
* width of at least `N` such as `int_fast8_t`.
|
||||
*/
|
||||
class FastestMinimumWidthIntegralType extends UserType {
|
||||
FastestMinimumWidthIntegralType() {
|
||||
this instanceof Int_fast8_t or
|
||||
this instanceof Int_fast16_t or
|
||||
this instanceof Int_fast32_t or
|
||||
this instanceof Int_fast64_t or
|
||||
this instanceof UInt_fast8_t or
|
||||
this instanceof UInt_fast16_t or
|
||||
this instanceof UInt_fast32_t or
|
||||
this instanceof UInt_fast64_t
|
||||
}
|
||||
abstract private class TFastestMinimumWidthIntegralType extends IntegralUnderlyingUserType { }
|
||||
|
||||
class FastestMinimumWidthIntegralType extends TFastestMinimumWidthIntegralType {
|
||||
FastestMinimumWidthIntegralType() { this instanceof TFastestMinimumWidthIntegralType }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C/C++ maximum-width numeric type, either `intmax_t` or `uintmax_t`.
|
||||
*/
|
||||
class MaximumWidthIntegralType extends UserType {
|
||||
MaximumWidthIntegralType() {
|
||||
this instanceof Intmax_t or
|
||||
this instanceof Uintmax_t
|
||||
}
|
||||
abstract private class TMaximumWidthIntegralType extends IntegralUnderlyingUserType { }
|
||||
|
||||
class MaximumWidthIntegralType extends TMaximumWidthIntegralType {
|
||||
MaximumWidthIntegralType() { this instanceof TMaximumWidthIntegralType }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +117,7 @@ class FixedWidthEnumType extends UserType {
|
||||
/**
|
||||
* The C/C++ `int8_t` type.
|
||||
*/
|
||||
class Int8_t extends IntegralUnderlyingUserType {
|
||||
class Int8_t extends TFixedWidthIntegralType {
|
||||
Int8_t() { this.hasGlobalOrStdName("int8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int8_t" }
|
||||
@@ -148,7 +126,7 @@ class Int8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int16_t` type.
|
||||
*/
|
||||
class Int16_t extends IntegralUnderlyingUserType {
|
||||
class Int16_t extends TFixedWidthIntegralType {
|
||||
Int16_t() { this.hasGlobalOrStdName("int16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int16_t" }
|
||||
@@ -157,7 +135,7 @@ class Int16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int32_t` type.
|
||||
*/
|
||||
class Int32_t extends IntegralUnderlyingUserType {
|
||||
class Int32_t extends TFixedWidthIntegralType {
|
||||
Int32_t() { this.hasGlobalOrStdName("int32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int32_t" }
|
||||
@@ -166,7 +144,7 @@ class Int32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int64_t` type.
|
||||
*/
|
||||
class Int64_t extends IntegralUnderlyingUserType {
|
||||
class Int64_t extends TFixedWidthIntegralType {
|
||||
Int64_t() { this.hasGlobalOrStdName("int64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int64_t" }
|
||||
@@ -175,7 +153,7 @@ class Int64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint8_t` type.
|
||||
*/
|
||||
class UInt8_t extends IntegralUnderlyingUserType {
|
||||
class UInt8_t extends TFixedWidthIntegralType {
|
||||
UInt8_t() { this.hasGlobalOrStdName("uint8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt8_t" }
|
||||
@@ -184,7 +162,7 @@ class UInt8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint16_t` type.
|
||||
*/
|
||||
class UInt16_t extends IntegralUnderlyingUserType {
|
||||
class UInt16_t extends TFixedWidthIntegralType {
|
||||
UInt16_t() { this.hasGlobalOrStdName("uint16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt16_t" }
|
||||
@@ -193,7 +171,7 @@ class UInt16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint32_t` type.
|
||||
*/
|
||||
class UInt32_t extends IntegralUnderlyingUserType {
|
||||
class UInt32_t extends TFixedWidthIntegralType {
|
||||
UInt32_t() { this.hasGlobalOrStdName("uint32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt32_t" }
|
||||
@@ -202,7 +180,7 @@ class UInt32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint64_t` type.
|
||||
*/
|
||||
class UInt64_t extends IntegralUnderlyingUserType {
|
||||
class UInt64_t extends TFixedWidthIntegralType {
|
||||
UInt64_t() { this.hasGlobalOrStdName("uint64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt64_t" }
|
||||
@@ -211,7 +189,7 @@ class UInt64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_least8_t` type.
|
||||
*/
|
||||
class Int_least8_t extends IntegralUnderlyingUserType {
|
||||
class Int_least8_t extends TMinimumWidthIntegralType {
|
||||
Int_least8_t() { this.hasGlobalOrStdName("int_least8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_least8_t" }
|
||||
@@ -220,7 +198,7 @@ class Int_least8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_least16_t` type.
|
||||
*/
|
||||
class Int_least16_t extends IntegralUnderlyingUserType {
|
||||
class Int_least16_t extends TMinimumWidthIntegralType {
|
||||
Int_least16_t() { this.hasGlobalOrStdName("int_least16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_least16_t" }
|
||||
@@ -229,7 +207,7 @@ class Int_least16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_least32_t` type.
|
||||
*/
|
||||
class Int_least32_t extends IntegralUnderlyingUserType {
|
||||
class Int_least32_t extends TMinimumWidthIntegralType {
|
||||
Int_least32_t() { this.hasGlobalOrStdName("int_least32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_least32_t" }
|
||||
@@ -238,7 +216,7 @@ class Int_least32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_least64_t` type.
|
||||
*/
|
||||
class Int_least64_t extends IntegralUnderlyingUserType {
|
||||
class Int_least64_t extends TMinimumWidthIntegralType {
|
||||
Int_least64_t() { this.hasGlobalOrStdName("int_least64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_least64_t" }
|
||||
@@ -247,7 +225,7 @@ class Int_least64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_least8_t` type.
|
||||
*/
|
||||
class UInt_least8_t extends IntegralUnderlyingUserType {
|
||||
class UInt_least8_t extends TMinimumWidthIntegralType {
|
||||
UInt_least8_t() { this.hasGlobalOrStdName("uint_least8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_least8_t" }
|
||||
@@ -256,7 +234,7 @@ class UInt_least8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_least16_t` type.
|
||||
*/
|
||||
class UInt_least16_t extends IntegralUnderlyingUserType {
|
||||
class UInt_least16_t extends TMinimumWidthIntegralType {
|
||||
UInt_least16_t() { this.hasGlobalOrStdName("uint_least16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_least16_t" }
|
||||
@@ -265,7 +243,7 @@ class UInt_least16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_least32_t` type.
|
||||
*/
|
||||
class UInt_least32_t extends IntegralUnderlyingUserType {
|
||||
class UInt_least32_t extends TMinimumWidthIntegralType {
|
||||
UInt_least32_t() { this.hasGlobalOrStdName("uint_least32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_least32_t" }
|
||||
@@ -274,7 +252,7 @@ class UInt_least32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_least64_t` type.
|
||||
*/
|
||||
class UInt_least64_t extends IntegralUnderlyingUserType {
|
||||
class UInt_least64_t extends TMinimumWidthIntegralType {
|
||||
UInt_least64_t() { this.hasGlobalOrStdName("uint_least64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_least64_t" }
|
||||
@@ -283,7 +261,7 @@ class UInt_least64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_fast8_t` type.
|
||||
*/
|
||||
class Int_fast8_t extends IntegralUnderlyingUserType {
|
||||
class Int_fast8_t extends TFastestMinimumWidthIntegralType {
|
||||
Int_fast8_t() { this.hasGlobalOrStdName("int_fast8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_fast8_t" }
|
||||
@@ -292,7 +270,7 @@ class Int_fast8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_fast16_t` type.
|
||||
*/
|
||||
class Int_fast16_t extends IntegralUnderlyingUserType {
|
||||
class Int_fast16_t extends TFastestMinimumWidthIntegralType {
|
||||
Int_fast16_t() { this.hasGlobalOrStdName("int_fast16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_fast16_t" }
|
||||
@@ -301,7 +279,7 @@ class Int_fast16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_fast32_t` type.
|
||||
*/
|
||||
class Int_fast32_t extends IntegralUnderlyingUserType {
|
||||
class Int_fast32_t extends TFastestMinimumWidthIntegralType {
|
||||
Int_fast32_t() { this.hasGlobalOrStdName("int_fast32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_fast32_t" }
|
||||
@@ -310,7 +288,7 @@ class Int_fast32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `int_fast64_t` type.
|
||||
*/
|
||||
class Int_fast64_t extends IntegralUnderlyingUserType {
|
||||
class Int_fast64_t extends TFastestMinimumWidthIntegralType {
|
||||
Int_fast64_t() { this.hasGlobalOrStdName("int_fast64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Int_fast64_t" }
|
||||
@@ -319,7 +297,7 @@ class Int_fast64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_fast8_t` type.
|
||||
*/
|
||||
class UInt_fast8_t extends IntegralUnderlyingUserType {
|
||||
class UInt_fast8_t extends TFastestMinimumWidthIntegralType {
|
||||
UInt_fast8_t() { this.hasGlobalOrStdName("uint_fast8_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_fast8_t" }
|
||||
@@ -328,7 +306,7 @@ class UInt_fast8_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_fast16_t` type.
|
||||
*/
|
||||
class UInt_fast16_t extends IntegralUnderlyingUserType {
|
||||
class UInt_fast16_t extends TFastestMinimumWidthIntegralType {
|
||||
UInt_fast16_t() { this.hasGlobalOrStdName("uint_fast16_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_fast16_t" }
|
||||
@@ -337,7 +315,7 @@ class UInt_fast16_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_fast32_t` type.
|
||||
*/
|
||||
class UInt_fast32_t extends IntegralUnderlyingUserType {
|
||||
class UInt_fast32_t extends TFastestMinimumWidthIntegralType {
|
||||
UInt_fast32_t() { this.hasGlobalOrStdName("uint_fast32_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_fast32_t" }
|
||||
@@ -346,7 +324,7 @@ class UInt_fast32_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uint_fast64_t` type.
|
||||
*/
|
||||
class UInt_fast64_t extends IntegralUnderlyingUserType {
|
||||
class UInt_fast64_t extends TFastestMinimumWidthIntegralType {
|
||||
UInt_fast64_t() { this.hasGlobalOrStdName("uint_fast64_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "UInt_fast64_t" }
|
||||
@@ -355,7 +333,7 @@ class UInt_fast64_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `intmax_t` type.
|
||||
*/
|
||||
class Intmax_t extends IntegralUnderlyingUserType {
|
||||
class Intmax_t extends TMaximumWidthIntegralType {
|
||||
Intmax_t() { this.hasGlobalOrStdName("intmax_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Intmax_t" }
|
||||
@@ -364,7 +342,7 @@ class Intmax_t extends IntegralUnderlyingUserType {
|
||||
/**
|
||||
* The C/C++ `uintmax_t` type.
|
||||
*/
|
||||
class Uintmax_t extends IntegralUnderlyingUserType {
|
||||
class Uintmax_t extends TMaximumWidthIntegralType {
|
||||
Uintmax_t() { this.hasGlobalOrStdName("uintmax_t") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Uintmax_t" }
|
||||
|
||||
Reference in New Issue
Block a user