Skip to content

emit fixes for improperly annotated symbols#57

Merged
compnerd merged 2 commits intocompnerd:mainfrom
andrurogerz:negative-checks
Jul 8, 2025
Merged

emit fixes for improperly annotated symbols#57
compnerd merged 2 commits intocompnerd:mainfrom
andrurogerz:negative-checks

Conversation

@andrurogerz
Copy link
Collaborator

Purpose

Update ids to emit fixes to remove export annotations in places where they may cause problems.

Overview

This patch updates ids so that it emits FixIts to remove export annotation macros in places where they may cause problems. It is intentionally less aggressive at removing annotations than it could be.

The export annotation is removed in the following cases:

  • Class/struct members when the containing class/struct is already annotated
  • Functions and methods that are defined inline
  • Pure virtual methods
  • Defaulted or deleted methods
  • Global variables that are not extern or static member fields
  • static member fields that are initialized inline

The following specific changes were made to the ids implementation:

  • Introduce a new diagnostic issue to use whenever an improper export annotation is found.
  • Implement a new check_symbol_not_exported method reports the new improper export diagnostic if the specified symbol has an export annotation.
  • Reorder checks in export_function_if_needed and export_variable_if_needed so that some checks occur earlier. This is done because we only report mistaken annotations in a subset of cases where we would choose to not add them.
  • Add calls to check_symbol_not_exported from export_function_if_needed and export_variable_if_needed in cases where we want to remove annotations when present.
  • Update Tests/lit.cfg to set config.supports_substitutions = True. This enables if/else conditional check on Windows in the new test case file
  • Update Tests/lit.cfg to set system-windows when running on Windows. This lets us special-case Windows in the new test case file. Required because idt will fail (due to compilation failure) with a non-zero exit code in some cases when symbols are annotated for DLL export.

Validation

@andrurogerz andrurogerz marked this pull request as draft July 7, 2025 21:48
@andrurogerz andrurogerz marked this pull request as ready for review July 8, 2025 00:34
@andrurogerz andrurogerz requested a review from compnerd July 8, 2025 00:35
@compnerd compnerd merged commit b3bf35d into compnerd:main Jul 8, 2025
2 checks passed
@andrurogerz andrurogerz deleted the negative-checks branch July 8, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants