-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Diags-Experimental-Formatting] Fixes for #sourceLocation #31124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Diags-Experimental-Formatting] Fixes for #sourceLocation #31124
Conversation
owenv
commented
Apr 18, 2020
- Always use the line number in the actual source file when extracting excerpts and adding highlights/fix-its (SourceManager::getLineNumber and SourceManager::getLineAndCol return the real and virtual line numbers respectively)
- Always use the display name when printing excerpt titles
- Don't print surrounding lines when an annotated line is in a virtual file
|
@swift-ci smoke test |
4a17a9f to
aa43637
Compare
|
The second commit is an additional test case I added to make sure the new style works when swift emits a diagnostic in a clang-owned buffer, which also interacts with virtual files |
|
@swift-ci please smoke test |
|
@swift-ci please smoke test macOS |
aa43637 to
0fd1821
Compare
…sourceLocation is used - Always use the line number in the actual source file when extracting excerpts and adding highlights/fix-its - Always use the display name when printing excerpt titles - Don't print surrounding lines when an annotated line is in a virtual file This reverts commit f919e04.
…emitted in clang virtual files
0fd1821 to
96696c8
Compare
|
@swift-ci smoke test |
|
@rintaro I saw you posted about some of the issues working with real and virtual source locations a few years ago here: https://forums.swift.org/t/filename-line-and-column-for-sourceloc/5463 Do you mind looking over these changes, I think I'm fixing a similar kind of problem? I don't know if adding an Also, are you still interested in renaming some of these methods? If so, I might try to rename at least SourceManager::getLineNumber and SourceManager::getLineAndCol in a follow-up PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. As for isLocInVirtualFile() I cannot think of any better option.
Also, are you still interested in renaming some of these methods? If so, I might try to rename at least SourceManager::getLineNumber and SourceManager::getLineAndCol in a follow-up PR.
Yes, the current method names are very confusing and error prone. Thank you for working on this!
|
@swift-ci smoke test and merge |