Skip to content

Commit 946d5df

Browse files
committed
Fix formatting
1 parent e3a5b8c commit 946d5df

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

cpp/common/src/codingstandards/cpp/rules/castcharbeforeconvertingtolargersizes/CastCharBeforeConvertingToLargerSizes.qll

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@
22
* Provides a library which includes a `problems` predicate for reporting....
33
*/
44

5-
import cpp
6-
import codingstandards.cpp.Customizations
7-
import codingstandards.cpp.Exclusions
8-
9-
abstract class CastCharBeforeConvertingToLargerSizesSharedQuery extends Query { }
10-
11-
Query getQuery() { result instanceof CastCharBeforeConvertingToLargerSizesSharedQuery }
12-
13-
query predicate problems(Cast c, string message) {
14-
not isExcluded(c, getQuery()) and
15-
// find cases where there is a conversion happening wherein the
16-
// base type is a char
17-
c.getExpr().getType() instanceof CharType and
18-
not c.getExpr().getType() instanceof UnsignedCharType and
19-
// it's a bigger type
20-
c.getType().getSize() > c.getExpr().getType().getSize() and
21-
// and it's some kind of integer type
22-
c.getType().getUnderlyingType() instanceof IntegralType and
23-
not c.isFromTemplateInstantiation(_) and
24-
message =
25-
"Expression not converted to `unsigned char` before converting to a larger integer type."
26-
}
27-
5+
import cpp
6+
import codingstandards.cpp.Customizations
7+
import codingstandards.cpp.Exclusions
8+
9+
abstract class CastCharBeforeConvertingToLargerSizesSharedQuery extends Query { }
10+
11+
Query getQuery() { result instanceof CastCharBeforeConvertingToLargerSizesSharedQuery }
12+
13+
query predicate problems(Cast c, string message) {
14+
not isExcluded(c, getQuery()) and
15+
// find cases where there is a conversion happening wherein the
16+
// base type is a char
17+
c.getExpr().getType() instanceof CharType and
18+
not c.getExpr().getType() instanceof UnsignedCharType and
19+
// it's a bigger type
20+
c.getType().getSize() > c.getExpr().getType().getSize() and
21+
// and it's some kind of integer type
22+
c.getType().getUnderlyingType() instanceof IntegralType and
23+
not c.isFromTemplateInstantiation(_) and
24+
message =
25+
"Expression not converted to `unsigned char` before converting to a larger integer type."
26+
}

0 commit comments

Comments
 (0)