mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
C++: Ensure we can round trip between (forward) class declarations
This was already possible when the forward class declaration and the class definition occurred in the same scope. However, there is a common C++ usage pattern in which this is not the case (when only a pointer to the class is needed). In this latter scenario we could not round trip between the (forward) `DeclarationEntry` and the `Declaration`. Effectively this changes the code to: ``` if exists(TypeDeclarationEntry e | e.getType() = this) then result.getType() = this else ... ``` We use `type_decls` instead to stay close to the original code.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
| declarationEntry.cpp:39:7:39:7 | operator= | declarationEntry.cpp:39:7:39:7 | declaration of operator= | 1 | 1 |
|
||||
| declarationEntry.cpp:39:7:39:7 | operator= | declarationEntry.cpp:39:7:39:7 | declaration of operator= | 1 | 1 |
|
||||
| declarationEntry.cpp:39:7:39:13 | myClass | declarationEntry.cpp:39:7:39:13 | definition of myClass | 1 | 1 |
|
||||
| declarationEntry.cpp:39:7:39:13 | myClass | forwardDeclaration.cpp:1:7:1:13 | declaration of myClass | 0 | 1 |
|
||||
| declarationEntry.cpp:39:7:39:13 | myClass | forwardDeclaration.cpp:1:7:1:13 | declaration of myClass | 1 | 1 |
|
||||
| declarationEntry.cpp:42:6:42:21 | myMemberVariable | declarationEntry.cpp:42:6:42:21 | definition of myMemberVariable | 1 | 1 |
|
||||
| forwardDeclaration.cpp:3:10:3:19 | myClassPtr | forwardDeclaration.cpp:3:10:3:19 | definition of myClassPtr | 1 | 1 |
|
||||
| macro.c:2:1:2:3 | foo | macro.c:2:1:2:3 | declaration of foo | 1 | 1 |
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
| file://:0:0:0:0 | definition of gp_offset | file://:0:0:0:0 | gp_offset | yes |
|
||||
| file://:0:0:0:0 | definition of overflow_arg_area | file://:0:0:0:0 | overflow_arg_area | yes |
|
||||
| file://:0:0:0:0 | definition of reg_save_area | file://:0:0:0:0 | reg_save_area | yes |
|
||||
| forwardDeclaration.cpp:1:7:1:13 | declaration of myClass | declarationEntry.cpp:39:7:39:13 | myClass | no |
|
||||
| forwardDeclaration.cpp:1:7:1:13 | declaration of myClass | declarationEntry.cpp:39:7:39:13 | myClass | yes |
|
||||
| forwardDeclaration.cpp:3:10:3:19 | definition of myClassPtr | forwardDeclaration.cpp:3:10:3:19 | myClassPtr | yes |
|
||||
| macro.c:2:1:2:3 | declaration of foo | macro.c:2:1:2:3 | foo | yes |
|
||||
| macro.c:4:5:4:8 | definition of main | macro.c:4:5:4:8 | main | yes |
|
||||
|
||||
Reference in New Issue
Block a user