Skip to content

C++: Add compilation column to fileannotations - #22899

Open
jketema wants to merge 4 commits into
github:mainfrom
jketema:jketema/fileannotations
Open

jketema wants to merge 4 commits into
github:mainfrom
jketema:jketema/fileannotations

Conversation

@jketema

@jketema jketema commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

See internal PR. I'm omitting the change note, as this is not exposed through any QL libraries at the moment.

@jketema
jketema requested a review from a team as a code owner October 27, 2026 11:40
Copilot AI max review requested due to automatic review settings October 27, 2026 11:40
@jketema jketema added the depends on internal PR This PR should only be merged in sync with an internal Semmle PR label Oct 27, 2026
@jketema jketema added the no-change-note-required This PR does not need a change note label Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The placeholder compilation lacks completion data, causing false extraction-failure diagnostics in upgraded databases.

1 open issue
What changed in this PR

This PR extends the C/C++ CodeQL schema to associate file annotations with compilations while preserving existing file-level language checks.

Changes:

  • Add a compilation reference to fileannotations.
  • Update C and C++ file predicates for the expanded relation.
  • Add upgrade and downgrade migrations with matching schema snapshots.
File Description
cpp/​ql/​lib/​upgrades/​293904928d857b61a44dc0ff34c89c9eccb8a90a/​upgrades.ql Migrate existing annotations using a placeholder compilation.
cpp/​ql/​lib/​upgrades/​293904928d857b61a44dc0ff34c89c9eccb8a90a/​upgrade.properties Register the upgrade transformations.
cpp/​ql/​lib/​upgrades/​293904928d857b61a44dc0ff34c89c9eccb8a90a/​semmlecode.cpp.dbscheme Define the upgrade’s target schema.
cpp/​ql/​lib/​upgrades/​293904928d857b61a44dc0ff34c89c9eccb8a90a/​old.dbscheme Capture the pre-upgrade schema.
cpp/​ql/​lib/​semmlecode.cpp.dbscheme Add the compilation column to the current schema.
cpp/​ql/​lib/​semmle/​code/​cpp/​File.qll Preserve language checks across compilations.
cpp/​downgrades/​a765f5c5abd3e27f76d5c48fbd09c1b2e4c3febc/​upgrade.properties Register the downgrade transformation.
cpp/​downgrades/​a765f5c5abd3e27f76d5c48fbd09c1b2e4c3febc/​old.dbscheme Capture the downgrade’s input schema.
cpp/​downgrades/​a765f5c5abd3e27f76d5c48fbd09c1b2e4c3febc/​fileannotations.ql Remove the compilation column for older databases.

Review effort: Max

Comment on lines +18 to +19
compilation = Fresh::map(TPlaceHolderCompilation()) and
cwd = ""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine given that we only claim "partial" support.

@github-actions github-actions Bot added the C++ label Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ depends on internal PR This PR should only be merged in sync with an internal Semmle PR no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants