Skip to content

Commit 9ddf645

Browse files
committed
BuiltInTypeRules: Rename realType to builtInType
1 parent 2d14c81 commit 9ddf645

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cpp/misra/src/codingstandards/cpp/misra/BuiltInTypeRules.qll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ newtype TypeCategory =
2222
*
2323
* This does not apply the rules related to stripping specifiers or typedefs, or references.
2424
*/
25-
TypeCategory getTypeCategory(BuiltInType t) {
25+
private TypeCategory getBuiltInTypeCategory(BuiltInType t) {
2626
(
2727
t instanceof PlainCharType or
2828
t instanceof WideCharType or
@@ -64,7 +64,7 @@ TypeCategory getTypeCategory(BuiltInType t) {
6464
*
6565
* This function will strip specifiers and typedefs to get the underlying built-in type.
6666
*/
67-
BuiltInType getBuiltInType(Type t) {
67+
private BuiltInType getBuiltInType(Type t) {
6868
// Get the built-in type of a type, if it is a built-in type
6969
result = t
7070
or
@@ -87,15 +87,15 @@ newtype Signedness =
8787

8888
class CharacterType extends Type {
8989
// The actual character type, which is either a plain char or a wide char
90-
BuiltInType realType;
90+
BuiltInType builtInType;
9191

9292
CharacterType() {
9393
// A type whose type category is character
94-
getTypeCategory(realType) = Character() and
95-
realType = getBuiltInType(this)
94+
getBuiltInTypeCategory(builtInType) = Character() and
95+
builtInType = getBuiltInType(this)
9696
}
9797

98-
Type getRealType() { result = realType }
98+
BuiltInType getRealType() { result = builtInType }
9999
}
100100

101101
/**
@@ -108,34 +108,34 @@ class CharacterType extends Type {
108108
*/
109109
class NumericType extends Type {
110110
// The actual numeric type, which is either an integral or a floating-point type.
111-
Type realType;
111+
BuiltInType builtInType;
112112

113113
NumericType() {
114114
// A type whose type category is either integral or a floating-point
115-
getTypeCategory(realType) = [Integral().(TypeCategory), FloatingPoint()] and
116-
realType = getBuiltInType(this)
115+
getBuiltInTypeCategory(builtInType) = [Integral().(TypeCategory), FloatingPoint()] and
116+
builtInType = getBuiltInType(this)
117117
}
118118

119119
Signedness getSignedness() {
120-
if realType.(IntegralType).isUnsigned() then result = Unsigned() else result = Signed()
120+
if builtInType.(IntegralType).isUnsigned() then result = Unsigned() else result = Signed()
121121
}
122122

123123
/** Gets the size of the actual numeric type. */
124-
int getRealSize() { result = realType.getSize() }
124+
int getRealSize() { result = builtInType.getSize() }
125125

126-
TypeCategory getTypeCategory() { result = getTypeCategory(realType) }
126+
TypeCategory getTypeCategory() { result = getBuiltInTypeCategory(builtInType) }
127127

128128
/**
129129
* Gets the integeral upper bound of the numeric type, if it represents an integer type.
130130
*/
131-
QlBuiltins::BigInt getIntegralUpperBound() { integralTypeBounds(realType, _, result) }
131+
QlBuiltins::BigInt getIntegralUpperBound() { integralTypeBounds(builtInType, _, result) }
132132

133133
/**
134134
* Gets the integeral lower bound of the numeric type, if it represents an integer type.
135135
*/
136-
QlBuiltins::BigInt getIntegralLowerBound() { integralTypeBounds(realType, result, _) }
136+
QlBuiltins::BigInt getIntegralLowerBound() { integralTypeBounds(builtInType, result, _) }
137137

138-
Type getRealType() { result = realType }
138+
BuiltInType getRealType() { result = builtInType }
139139
}
140140

141141
predicate isSignedType(NumericType t) { t.getSignedness() = Signed() }

0 commit comments

Comments
 (0)