File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
common/src/codingstandards/cpp
misra/src/codingstandards/cpp/misra Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 1+ import cpp
2+ import codingstandards.cpp.types.Type
3+
4+ /**
5+ * Gets the `FunctionType` of an expression call.
6+ */
7+ FunctionType getExprCallFunctionType ( ExprCall call ) {
8+ // A standard expression call
9+ // Returns a FunctionPointerIshType
10+ result = call .( ExprCall ) .getExpr ( ) .getType ( )
11+ or
12+ // An expression call using the pointer to member operator (.* or ->*)
13+ // This special handling is required because we don't have a CodeQL class representing the call
14+ // to a pointer to member function, but the right hand side is extracted as the -1 child of the
15+ // call.
16+ // Returns a RoutineType
17+ result = call .( ExprCall ) .getChild ( - 1 ) .getType ( ) .( PointerToMemberType ) .getBaseType ( )
18+ }
Original file line number Diff line number Diff line change 44
55import cpp
66import codingstandards.cpp.misra
7+ import codingstandards.cpp.Call
78import codingstandards.cpp.Type
89
910/**
@@ -120,19 +121,6 @@ class CanonicalIntegerTypes extends NumericType, IntegralType {
120121 CanonicalIntegerTypes ( ) { this = this .getCanonicalArithmeticType ( ) }
121122}
122123
123- FunctionType getExprCallFunctionType ( ExprCall call ) {
124- // A standard expression call
125- // Returns a FunctionPointerIshType
126- result = call .( ExprCall ) .getExpr ( ) .getType ( )
127- or
128- // An expression call using the pointer to member operator (.* or ->*)
129- // This special handling is required because we don't have a CodeQL class representing the call
130- // to a pointer to member function, but the right hand side is extracted as the -1 child of the
131- // call.
132- // Returns a RoutineType
133- result = call .( ExprCall ) .getChild ( - 1 ) .getType ( ) .( PointerToMemberType ) .getBaseType ( )
134- }
135-
136124predicate isAssignment ( Expr source , NumericType targetType , string context ) {
137125 exists ( Expr preConversionAssignment |
138126 isPreConversionAssignment ( preConversionAssignment , targetType , context ) and
You can’t perform that action at this time.
0 commit comments