File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
common/src/codingstandards/cpp Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 39
39
// Exclude `nullptr`
40
40
not l .getType ( ) instanceof NullPointerType and
41
41
// Exclude boolean `true` and `false`
42
- not l . getType ( ) instanceof BoolType and
42
+ not l instanceof BoolLiteral and
43
43
// Exclude empty string
44
44
not l .getValue ( ) = "" and
45
45
// Template functions use literals to represent calls which are unknown
Original file line number Diff line number Diff line change @@ -47,3 +47,15 @@ class CompileTimeComputedIntegralLiteral extends Literal {
47
47
not any ( ConstructorFieldInit cfi ) .getExpr ( ) = this
48
48
}
49
49
}
50
+
51
+ class BoolLiteral extends Literal {
52
+ BoolLiteral ( ) {
53
+ this .getType ( ) instanceof BoolType
54
+ or
55
+ // When used as non-type template arguments, bool literals might
56
+ // have been converted to a non-bool type.
57
+ this .getValue ( ) = "1" and this .getValueText ( ) = "true"
58
+ or
59
+ this .getValue ( ) = "0" and this .getValueText ( ) = "false"
60
+ }
61
+ }
You can’t perform that action at this time.
0 commit comments