Skip to content

properly position annotation on qualified record declarations#54

Merged
compnerd merged 1 commit intocompnerd:mainfrom
andrurogerz:qualified-record-name
May 8, 2025
Merged

properly position annotation on qualified record declarations#54
compnerd merged 1 commit intocompnerd:mainfrom
andrurogerz:qualified-record-name

Conversation

@andrurogerz
Copy link
Collaborator

@andrurogerz andrurogerz commented May 7, 2025

Overview

Properly position the annotation on qualified struct/class declarations.

Background

Prior to this change, IDS would incorrectly emit the position for a record annotation like so:

/home/andrew/src/ids/Tests/QualifiedRecordNames.hh:9:28: remark: unexported public interface 'QualifiedNameClass'
    9 | struct ContainerNamespace::QualifiedNameClass {
      |                            ^
      |                            IDT_TEST_ABI

Having the annotation in this position is invalid and will not compile.

NOTE: special handling for qualified names is only necessary when annotating records. This is because the annotation has to follow the class/struct/union keyword. For variables and functions, the annotation always goes at the beginning of the declaration reported by getBeginLoc().

Validation

New test cases.
Manually verified the fixit is properly positioned.

/home/andrew/src/ids/Tests/QualifiedRecordNames.hh:9:8: remark: unexported public interface 'QualifiedNameClass'
    9 | struct ContainerNamespace::QualifiedNameClass {
      |        ^
      |        IDT_TEST_ABI

@andrurogerz andrurogerz requested a review from compnerd May 8, 2025 00:41
@compnerd compnerd merged commit d733d4e into compnerd:main May 8, 2025
2 checks passed
@andrurogerz andrurogerz deleted the qualified-record-name branch July 8, 2025 15:16
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