File tree Expand file tree Collapse file tree 12 files changed +110
-0
lines changed
cpp/ql/test/library-tests/structs Expand file tree Collapse file tree 12 files changed +110
-0
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,9 @@ class Damson {
2424 int damson_x;
2525 void foo ();
2626};
27+
28+ namespace unrelated {
29+ class AppleCompatible {
30+ long apple_x;
31+ };
32+ }
Original file line number Diff line number Diff line change 3232| b1.cpp:23:7:23:12 | Damson | 5 members | 2 locations | 1 | foo |
3333| b1.cpp:23:7:23:12 | Damson | 5 members | 2 locations | 2 | operator= |
3434| b1.cpp:23:7:23:12 | Damson | 5 members | 2 locations | 3 | operator= |
35+ | b1.cpp:29:9:29:23 | AppleCompatible | 3 members | 1 locations | 0 | apple_x |
36+ | b1.cpp:29:9:29:23 | AppleCompatible | 3 members | 1 locations | 1 | operator= |
37+ | b1.cpp:29:9:29:23 | AppleCompatible | 3 members | 1 locations | 2 | operator= |
3538| b2.cpp:2:7:2:21 | AppleCompatible | 3 members | 2 locations | 0 | apple_x |
3639| b2.cpp:2:7:2:21 | AppleCompatible | 3 members | 2 locations | 1 | operator= |
3740| b2.cpp:2:7:2:21 | AppleCompatible | 3 members | 2 locations | 2 | operator= |
Original file line number Diff line number Diff line change 1010| b1.cpp:11:7:11:22 | BananaCompatible | 0 | file://:0:0:0:0 | int | 1 types |
1111| b1.cpp:16:7:16:12 | Cherry | 0 | file://:0:0:0:0 | int | 1 types |
1212| b1.cpp:23:7:23:12 | Damson | 0 | file://:0:0:0:0 | int | 1 types |
13+ | b1.cpp:29:9:29:23 | AppleCompatible | 0 | file://:0:0:0:0 | long | 1 types |
1314| b2.cpp:2:7:2:21 | AppleCompatible | 0 | file://:0:0:0:0 | int | 1 types |
1415| b2.cpp:9:7:9:22 | BananaCompatible | 0 | file://:0:0:0:0 | int | 1 types |
1516| b2.cpp:14:7:14:12 | Cherry | 0 | file://:0:0:0:0 | short | 1 types |
Original file line number Diff line number Diff line change 1+ | a.h:5:8:5:13 | cheese | x.cpp:6:10:6:12 | Foo | 3 |
2+ | a.h:5:8:5:13 | cheese | x.cpp:12:9:12:11 | Foo | 3 |
13| a.h:5:8:5:13 | cheese | y.cpp:4:8:4:10 | Foo | 3 |
24| x.cpp:3:6:3:10 | bar_x | a.h:4:8:4:10 | Bar | 3 |
5+ | x.cpp:19:6:19:10 | foo_x | x.cpp:6:10:6:12 | Foo | 3 |
6+ | x.cpp:19:6:19:10 | foo_x | x.cpp:12:9:12:11 | Foo | 3 |
7+ | x.cpp:19:6:19:10 | foo_x | y.cpp:4:8:4:10 | Foo | 3 |
8+ | x.cpp:23:5:23:17 | templateField | x.cpp:6:10:6:12 | Foo | 3 |
9+ | x.cpp:23:5:23:17 | templateField | x.cpp:12:9:12:11 | Foo | 3 |
10+ | x.cpp:26:18:26:29 | template_foo | x.cpp:22:7:22:14 | Template<Foo *> | 3 |
11+ | x.cpp:26:18:26:29 | template_foo | x.cpp:22:7:22:14 | Template<Foo *> | 3 |
Original file line number Diff line number Diff line change 11#include " a.h"
22
33Bar *bar_x;
4+
5+ namespace unrelated {
6+ struct Foo {
7+ short val;
8+ };
9+ }
10+
11+ struct ContainsAnotherFoo {
12+ class Foo {
13+ long val;
14+ };
15+ };
16+
17+ // The type of `foo_x` should not refer to any of the above classes, none of
18+ // which are named `Foo` in the global scope.
19+ Foo *foo_x;
20+
21+ template <typename T>
22+ class Template {
23+ T templateField;
24+ };
25+
26+ Template<Foo *> *template_foo;
27+
28+ // Instantiation of the template with unrelated classes named `Foo` should not
29+ // get mixed up with the instantiation above.
30+ template class Template <unrelated::Foo *>;
31+ template class Template <ContainsAnotherFoo::Foo *>;
Original file line number Diff line number Diff line change 1+ #include " header.h"
2+
3+ struct MultipleDefsButSameHeader {
4+ int i;
5+ };
6+
7+ struct OneDefInDifferentFile {
8+ int i;
9+ };
Original file line number Diff line number Diff line change 1+ #include " header.h"
2+
3+ struct MultipleDefsButSameHeader {
4+ char char1;
5+ char char2;
6+ };
Original file line number Diff line number Diff line change 1+ namespace foo {
2+ class C ;
3+
4+ C *x;
5+ }
Original file line number Diff line number Diff line change 1+ namespace foo {
2+ class C {
3+ };
4+ }
5+
6+ namespace bar {
7+ class C {
8+ };
9+ }
10+
11+ class DefinedAndDeclared {
12+ };
13+
14+ // Despite this declaration being present, the variable below is associated
15+ // with the definition above rather than this declaration.
16+ class DefinedAndDeclared ;
17+
18+ DefinedAndDeclared *definedAndDeclared;
19+
20+ #include " header.h"
21+
22+ // Because there are multiple definitions of `MultipleDefsButSameHeader`, the
23+ // type of this variable will refer to the declaration in `header.h` rather
24+ // than any of the definitions.
25+ MultipleDefsButSameHeader *mdbsh;
26+
27+ // Because there is only one definition of `OneDefInDifferentFile`, the type of
28+ // this variable will refer to that definition.
29+ OneDefInDifferentFile *odidf;
Original file line number Diff line number Diff line change 1+ struct MultipleDefsButSameHeader ;
2+
3+ struct OneDefInDifferentFile ;
You can’t perform that action at this time.
0 commit comments