Skip to content

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Jan 12, 2022

C# 10 introduced a new #line pragma, where it is possible to specify, how start and end (line and column) including an offset should be printed, when a compiler warning is issued.
In the PR we

  • Introduce support for the new construct
  • Include some testcases
  • Make some minor refactoring to avoid magic numbers (introducing an enum for #line kind)
  • Update stats to include the new tables (unfortunately they are empty).

@michaelnebel michaelnebel marked this pull request as ready for review January 18, 2022 08:38
@michaelnebel michaelnebel requested a review from a team as a code owner January 18, 2022 08:38
@michaelnebel
Copy link
Contributor Author

Need to also look into the SourceLocation stuff (forgot that). Will write something here, when investigation is finished.

@michaelnebel
Copy link
Contributor Author

Need to also look into the SourceLocation stuff (forgot that). Will write something here, when investigation is finished.

Tried to do some dev testing of this and looks like it is working out of the box.

query predicate elements(Assignment statement, File f) { statement.getLocation().getFile() = f }

Which among other things produced the output

| LinePragmasRef1.cs:1:9:1:13 | Int32 i = ... | LinePragmasRef1.cs:0:0:0:0 | LinePragmasRef1.cs |
| LinePragmasRef2.cs:2:13:2:17 | Int32 j = ... | LinePragmasRef2.cs:0:0:0:0 | LinePragmasRef2.cs |

and it looks like this respects the line span pragma info.

@michaelnebel
Copy link
Contributor Author

Ready for review.

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

Approach LGTM.

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

LGTM. Then we just need a final DCA run, since the stats have been updated.

@michaelnebel
Copy link
Contributor Author

LGTM. Then we just need a final DCA run, since the stats have been updated.

Great! I will start one.

@michaelnebel
Copy link
Contributor Author

Execution times are looking good. Merging now.

@michaelnebel michaelnebel merged commit 547f492 into github:main Jan 20, 2022
@michaelnebel michaelnebel deleted the csharp/line-pragma branch January 20, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants