|
29 | 29 | // Conversion from non-character type to character type |
30 | 30 | not sourceType instanceof CharacterType and |
31 | 31 | targetType instanceof CharacterType |
32 | | - // or |
33 | | - // // Conversion between different character types |
34 | | - // getTypeCategory(sourceType) instanceof Character and |
35 | | - // getTypeCategory(targetType) instanceof Character and |
36 | | - // not sourceType = targetType |
37 | 32 | ) and |
38 | 33 | // Exclude conversions where both operands have the same character type in equality operations |
39 | 34 | not exists(EqualityOperation eq, CharacterType leftType, CharacterType rightType | |
|
43 | 38 | leftType.getRealType() = rightType.getRealType() |
44 | 39 | ) and |
45 | 40 | // Exclude unevaluated operands |
46 | | - not ( |
47 | | - expr.getParent*() instanceof SizeofExprOperator or |
48 | | - expr.getParent*() instanceof SizeofTypeOperator or |
49 | | - expr.getParent*() instanceof TypeidOperator or |
50 | | - expr.getParent*() = any(Decltype dt).getExpr() or |
51 | | - expr.getParent*() instanceof StaticAssert |
52 | | - ) and |
53 | | - // Exclude optional comparisons that don't involve conversion |
54 | | - not exists(FunctionCall fc | |
55 | | - fc.getTarget().hasName("operator==") and |
56 | | - fc.getAnArgument() = expr and |
57 | | - fc.getQualifier().getType().hasName("optional") |
58 | | - ) |
| 41 | + not expr.isUnevaluated() |
59 | 42 | select expr, |
60 | 43 | "Conversion of character type '" + sourceType.getName() + "' to '" + targetType.getName() + |
61 | 44 | "' uses numerical value of character." |
0 commit comments