Skip to content

[NFC][SourceManager] Rename line and column APIs for clarity #31943

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

Merged
merged 1 commit into from
May 26, 2020

Conversation

owenv
Copy link
Contributor

@owenv owenv commented May 21, 2020

getLineAndColumn -> getPresumedLineAndColumnForLoc (respects #sourceLocation )
getLineNumber -> getLineAndColumnInBuffer (doesn't respect #sourceLocation )

This is a purely mechanical change (via Xcode refactoring) that applies some of the renaming suggested in https://forums.swift.org/t/filename-line-and-column-for-sourceloc/5463 by @rintaro . I've also been auditing calls to these methods to find incorrect uses, I'm going to split those into multiple PRs because they'd make this too hard to review.

Some of the other SourceManager API should probably be renamed too, but I think this s a good first step and will help address the most common cases of misuse.

@owenv owenv requested review from akyrtzi, rintaro and nathawes May 21, 2020 20:00
Copy link
Contributor

@akyrtzi akyrtzi left a comment

Choose a reason for hiding this comment

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

Nice one, thank you! 👍

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

Thanks!

@rintaro
Copy link
Member

rintaro commented May 21, 2020

@swift-ci Please smoke test

@rintaro
Copy link
Member

rintaro commented May 21, 2020

@swift-ci Please smoke test

@rintaro
Copy link
Member

rintaro commented May 21, 2020

@owenv lldb needs to be updated.

/home/buildnode/jenkins/workspace/swift-PR-Linux-smoke-test/branch-master/llvm-project/lldb/source/Symbol/SwiftASTContext.cpp:2644:29: error: no member named 'getLineAndColumn' in 'swift::SourceManager'
      line_col = source_mgr.getLineAndColumn(source_loc);
                 ~~~~~~~~~~ ^

@owenv
Copy link
Contributor Author

owenv commented May 21, 2020

swiftlang/llvm-project#1252

@swift-ci please smoke test

@rintaro
Copy link
Member

rintaro commented May 22, 2020

swiftlang/llvm-project#1252
@swift-ci Please test Windows

1 similar comment
@rintaro
Copy link
Member

rintaro commented May 22, 2020

swiftlang/llvm-project#1252
@swift-ci Please test Windows

@rintaro
Copy link
Member

rintaro commented May 22, 2020

Windows bots don't support cross repo PR testing. @owenv feel free to merge this.

@owenv
Copy link
Contributor Author

owenv commented May 22, 2020

@rintaro sounds good, thanks! I’m rerunning tests on the other PR now due to some CI flakiness. If those pass I may need some help merging this as I don’t have llvm-project commit access

@hamishknight
Copy link
Contributor

@owenv Unfortunately it's not flakiness, the Linux bot is currently failing for all swift/master LLVM PRs :(

@owenv
Copy link
Contributor Author

owenv commented May 22, 2020

@hamishknight oh, thanks for the heads up, I hadn’t noticed the issue was more widespread. In that case I’ll just pick this back up next week, it’s pretty non-urgent

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.

4 participants