File tree 2 files changed +14
-18
lines changed
c/common/src/codingstandards/c
cpp/common/src/codingstandards/cpp
2 files changed +14
-18
lines changed Original file line number Diff line number Diff line change 1
1
import cpp
2
+ import codingstandards.cpp.Pointers
2
3
import codingstandards.cpp.UndefinedBehavior
3
4
4
5
/**
5
6
* Library for modeling undefined behavior.
6
7
*/
7
8
abstract class CUndefinedBehavior extends UndefinedBehavior { }
8
9
9
- class PointerOrArrayType extends DerivedType {
10
- PointerOrArrayType ( ) {
11
- this instanceof PointerType or
12
- this instanceof ArrayType
13
- }
14
- }
15
-
16
- Type get ( Function main ) {
17
- main .getName ( ) = "main" and
18
- main .getNumberOfParameters ( ) = 2 and
19
- main .getType ( ) .getUnderlyingType ( ) instanceof IntType and
20
- main .getParameter ( 0 ) .getType ( ) .getUnderlyingType ( ) instanceof IntType and
21
- result = main .getParameter ( 1 ) .getType ( ) .getUnderlyingType ( ) .( PointerOrArrayType ) .getBaseType ( )
22
- }
23
-
24
10
/**
25
11
* A function which has the signature - but not the name - of a main function.
26
12
*/
@@ -32,9 +18,9 @@ class C99MainFunction extends Function {
32
18
this .getParameter ( 1 )
33
19
.getType ( )
34
20
.getUnderlyingType ( )
35
- .( PointerOrArrayType )
21
+ .( UnspecifiedPointerOrArrayType )
36
22
.getBaseType ( )
37
- .( PointerOrArrayType )
23
+ .( UnspecifiedPointerOrArrayType )
38
24
.getBaseType ( ) instanceof CharType
39
25
or
40
26
this .getNumberOfParameters ( ) = 0 and
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import cpp
6
6
import codingstandards.cpp.Type
7
7
8
8
/**
9
- * A type that is a pointer or array type.
9
+ * A type that is a pointer or array type after stripping top-level specifiers .
10
10
*/
11
11
class PointerOrArrayType extends DerivedType {
12
12
PointerOrArrayType ( ) {
@@ -15,6 +15,16 @@ class PointerOrArrayType extends DerivedType {
15
15
}
16
16
}
17
17
18
+ /**
19
+ * A type that is a pointer or array type.
20
+ */
21
+ class UnspecifiedPointerOrArrayType extends DerivedType {
22
+ UnspecifiedPointerOrArrayType ( ) {
23
+ this instanceof PointerType or
24
+ this instanceof ArrayType
25
+ }
26
+ }
27
+
18
28
/**
19
29
* An expression which performs pointer arithmetic
20
30
*/
You can’t perform that action at this time.
0 commit comments