File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
cpp/misra/src/rules/RULE-7-0-1 Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1515
1616import cpp
1717import codingstandards.cpp.misra
18+ import codingstandards.cpp.misra.BuiltInTypeRules
1819
1920from Expr e , Conversion conv
2021where
3132 eq .getRightOperand ( ) .getType ( ) .stripTopLevelSpecifiers ( ) instanceof BoolType
3233 )
3334 or
34- // Exception: explicit constructor calls
35- exists ( ConstructorCall cc | cc .getAnArgument ( ) = e )
36- or
3735 // Exception: assignment to bit-field of length 1
38- exists ( AssignExpr assign |
39- assign .getRValue ( ) = e and
40- assign .getLValue ( ) .( ValueFieldAccess ) .getTarget ( ) .( BitField ) .getNumBits ( ) = 1
41- )
36+ isAssignedToBitfield ( e , _)
37+ // Note: conversions that result in a constructor call are not represented as `Conversion`s
38+ // in our model, so do not need to be excluded here.
4239 )
43- select e , "Conversion from 'bool' to '" + conv .getType ( ) . toString ( ) + "'."
40+ select e , "Conversion from 'bool' to '" + conv .getType ( ) + "'."
You can’t perform that action at this time.
0 commit comments