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 3939 // Exclude `nullptr`
4040 not l .getType ( ) instanceof NullPointerType and
4141 // Exclude boolean `true` and `false`
42- not l . getType ( ) instanceof BoolType and
42+ not l instanceof BoolLiteral and
4343 // Exclude empty string
4444 not l .getValue ( ) = "" and
4545 // 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 {
4747 not any ( ConstructorFieldInit cfi ) .getExpr ( ) = this
4848 }
4949}
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