Skip to content

Commit 67a7b75

Browse files
committed
CPP: Simplify getAFormatterWideType.
1 parent 605db44 commit 67a7b75

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cpp/ql/src/semmle/code/cpp/models/interfaces/FormattingFunction.qll

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ private Type stripTopLevelSpecifiersOnly(Type t) {
2121
* A type that is used as a format string by any formatting function.
2222
*/
2323
Type getAFormatterWideType() {
24-
exists(FormattingFunction ff, Type t |
25-
t = stripTopLevelSpecifiersOnly(ff.getDefaultCharType()) and
26-
t.getSize() != 1 and
27-
result.(PointerType).getBaseType() = t
24+
exists(FormattingFunction ff |
25+
result = stripTopLevelSpecifiersOnly(ff.getDefaultCharType()) and
26+
result.getSize() != 1
2827
)
2928
}
3029

@@ -33,9 +32,9 @@ Type getAFormatterWideType() {
3332
* there is none.
3433
*/
3534
private Type getAFormatterWideTypeOrDefault() {
36-
result = getAFormatterWideType().(PointerType).getBaseType() or
35+
result = getAFormatterWideType() or
3736
(
38-
not exists(getAFormatterWideType().(PointerType).getBaseType()) and
37+
not exists(getAFormatterWideType()) and
3938
result instanceof Wchar_t
4039
)
4140
}

0 commit comments

Comments
 (0)