Conversation
c5a36a3 to
aa4a6d7
Compare
53feba2 to
c41cf5b
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds support for C++ overlay functionality by introducing three new database relations: trap_filename, source_file_uses_trap, and in_trap. These relations enable tracking of TRAP file associations with source files and elements, which is essential for overlay mode operations where the system needs to identify which definitions come from which TRAP files.
Changes:
- Added three new database schema relations for tracking TRAP file relationships
- Created upgrade scripts to add the new relations to existing databases
- Created downgrade scripts to remove the relations when reverting the schema
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/ql/lib/semmlecode.cpp.dbscheme | Adds three new relations (trap_filename, source_file_uses_trap, in_trap) to the main C++ database schema |
| cpp/ql/lib/upgrades/9439176c1d1312787926458dd54d65a849069118/upgrade.properties | Defines the upgrade metadata with description and compatibility level |
| cpp/ql/lib/upgrades/9439176c1d1312787926458dd54d65a849069118/old.dbscheme | Contains the baseline schema before the changes (without the new relations) |
| cpp/downgrades/7e7c2f55670f8123d514cf542ccb1938118ac561/upgrade.properties | Defines the downgrade metadata and specifies deletion of the three new relations |
| cpp/downgrades/7e7c2f55670f8123d514cf542ccb1938118ac561/semmlecode.dbscheme | Contains the target schema after downgrade (without the new relations) |
| cpp/downgrades/7e7c2f55670f8123d514cf542ccb1938118ac561/old.dbscheme | Contains the baseline schema before downgrade (with the new relations) |
Comments suppressed due to low confidence (2)
cpp/ql/lib/semmlecode.cpp.dbscheme:257
- The
source_file_uses_traprelation lacks a keyset declaration. Consider adding#keyset[source_file, trap_file]to specify the primary key for this relation. This would clarify whether a source file can use multiple trap files or if the combination should be unique.
source_file_uses_trap(
string source_file: string ref,
int trap_file: @trap ref
);
cpp/ql/lib/semmlecode.cpp.dbscheme:265
- The
in_traprelation lacks a keyset declaration. Consider adding#keyset[element, trap_file]to specify the primary key for this relation. This would clarify the uniqueness constraints and whether an element can be defined in multiple trap files.
in_trap(
int element: @element ref,
int trap_file: @trap ref
);
| trap_filename( | ||
| int trap: @trap, | ||
| string filename: string ref | ||
| ); |
There was a problem hiding this comment.
The type @trap is used in the new relations but is never defined in the schema. Database schema types must be defined before they can be referenced. You should add a definition for @trap, similar to how @pch, @compilation, and other types are defined. This could be either a primitive type definition or a union type definition depending on what @trap represents.
| trap_filename( | ||
| int trap: @trap, | ||
| string filename: string ref | ||
| ); |
There was a problem hiding this comment.
The trap_filename relation lacks a keyset declaration. Consider adding #keyset[trap] or unique int trap: @trap constraint to clarify the primary key and ensure data integrity. Looking at similar relations in the schema (e.g., pch_uses at line 267), relations typically have explicit key constraints defined.
This issue also appears in the following locations of the same file:
- line 254
- line 262
| trap_filename( | ||
| int trap: @trap, | ||
| string filename: string ref | ||
| ); |
There was a problem hiding this comment.
The same undefined type @trap issue exists in the downgrade old.dbscheme file. This file should match the main schema after the upgrade, so it must also define the @trap type.
This adds
trap_filename,source_file_uses_trapandin_trapfor C++ overlay support.