Skip to content

Commit dbdaa1d

Browse files
author
Robert Marsh
committed
C++: Replace getUnderlyingType().getUnspecifiedType()
1 parent e899120 commit dbdaa1d

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

cpp/ql/src/Best Practices/Exceptions/CatchingByValue.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
import cpp
1414

1515
from CatchBlock cb, Class caughtType
16-
where caughtType = cb.getParameter().getType().getUnderlyingType().getUnspecifiedType()
16+
where caughtType = cb.getParameter().getUnspecifiedType()
1717
select cb,
1818
"This should catch a " + caughtType.getName() + " by (const) reference rather than by value."

cpp/ql/src/Best Practices/Unused Entities/UnusedLocals.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TemplateDependentType extends Type {
4040
* A variable whose declaration has, or may have, side effects.
4141
*/
4242
predicate declarationHasSideEffects(Variable v) {
43-
exists(Class c | c = v.getType().getUnderlyingType().getUnspecifiedType() |
43+
exists(Class c | c = v.getUnspecifiedType() |
4444
c.hasConstructor() or
4545
c.hasDestructor()
4646
)

cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import cpp
1515

1616
predicate declarationHasSideEffects(Variable v) {
17-
exists(Class c | c = v.getType().getUnderlyingType().getUnspecifiedType() |
17+
exists(Class c | c = v.getUnspecifiedType() |
1818
c.hasConstructor() or c.hasDestructor()
1919
)
2020
}

cpp/ql/src/jsf/4.13 Functions/AV Rule 114.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import cpp
2121
predicate functionsMissingReturnStmt(Function f, ControlFlowNode blame) {
2222
f.fromSource() and
2323
exists(Type returnType |
24-
returnType = f.getType().getUnderlyingType().getUnspecifiedType() and
24+
returnType = f.getUnspecifiedType() and
2525
not returnType instanceof VoidType and
2626
not returnType instanceof TemplateParameter
2727
) and

cpp/ql/src/jsf/4.17 Types/AV Rule 147.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class InvalidFloatCastExpr extends Expr {
2424

2525
InvalidFloatCastExpr() {
2626
exists(Type src, Type dst |
27-
src = this.getUnderlyingType().getUnspecifiedType() and
28-
dst = this.getActualType().getUnderlyingType().getUnspecifiedType() and
27+
src = this.getUnspecifiedType() and
28+
dst = this.getActualType().getUnspecifiedType() and
2929
src.(GeneralPointerType).getBaseType() instanceof FloatingPointType and
3030
src.(GeneralPointerType).getBaseType() != dst.(GeneralPointerType).getBaseType()
3131
)

cpp/ql/src/jsf/4.17 Types/AV Rule 148.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ from SwitchStmt s
1717
where forex(SwitchCase sc | sc = s.getASwitchCase() and not sc instanceof DefaultCase |
1818
sc.getExpr().(VariableAccess).getTarget().isConst())
1919
// Allow switch on character types
20-
and not (s.getExpr().getUnderlyingType().getUnspecifiedType() instanceof CharType)
20+
and not (s.getExpr().getUnspecifiedType() instanceof CharType)
2121
select s, "Enumeration types should be used instead of integers to select from a limited series of choices."

cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 154.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import cpp
1818
from BitField bf
1919
where not bf.getUnspecifiedType().(IntegralType).isUnsigned()
2020
and not bf.getUnderlyingType() instanceof Enum
21-
and not bf.getUnderlyingType().getUnspecifiedType() instanceof BoolType
21+
and not bf.getUnspecifiedType() instanceof BoolType
2222
and not bf.getType().hasName("BOOL") // At least for C programs on Windows, BOOL is a common typedef for a type representing BoolType.
2323
and not bf.getDeclaredNumBits() = bf.getType().getSize() * 8 // If this is true, then there cannot be unsigned sign extension or overflow.
2424
and not bf.isAnonymous()

cpp/ql/src/jsf/4.21 Operators/AV Rule 164.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ predicate possibleValue(Variable v, Expr value) {
2323
}
2424

2525
predicate constantValue(Expr e, int value) {
26-
e.getType().getUnderlyingType().getUnspecifiedType() instanceof IntegralType and
26+
e.getUnspecifiedType() instanceof IntegralType and
2727
(
2828
// Either the expr has a constant value
2929
value = e.getValue().toInt() or

cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 182.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class NullPointer extends Expr {
1919
}
2020

2121
from Expr e, Type t1, Type t2
22-
where t1 = e.getUnderlyingType().getUnspecifiedType() and
23-
t2 = e.getActualType().getUnderlyingType().getUnspecifiedType() and
22+
where t1 = e.getUnspecifiedType() and
23+
t2 = e.getActualType().getUnspecifiedType() and
2424
t1 != t2 and
2525
(t1 instanceof PointerType or t2 instanceof PointerType) and
2626
not (t2 instanceof VoidPointerType and t1 instanceof PointerType) and

cpp/ql/src/semmle/code/cpp/commons/StructLikeClass.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ predicate getter(MemberVariable v, MemberFunction f, Class c) {
8888
*/
8989
predicate sameBaseType(Type t1, Type t2) {
9090
exists (Type base1, Type base2 |
91-
base1 = t1.getUnderlyingType().getUnspecifiedType() and
91+
base1 = t1.getUnspecifiedType() and
9292
base2 = t2.getUnspecifiedType().getUnspecifiedType() and
9393
(
9494
base1 = base2 or

0 commit comments

Comments
 (0)