Skip to content
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

[SR-6982] Improve internal compiler consistency #49530

Open
lattner mannequin opened this issue Feb 12, 2018 · 4 comments
Open

[SR-6982] Improve internal compiler consistency #49530

lattner mannequin opened this issue Feb 12, 2018 · 4 comments
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement

Comments

@lattner
Copy link
Mannequin

lattner mannequin commented Feb 12, 2018

Previous ID SR-6982
Radar None
Original Reporter @lattner
Type Improvement
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Improvement, StarterBug
Assignee None
Priority Medium

md5: 22bde6140d0fa9756c0c6301d019c71d

Issue Description:

As is typical for an established codebase that has been worked on by lots of different people, the consistency of naming and approach of things has drifted a bit over the last years. This makes it difficult to work on the compiler, particularly if you don't have full code completion at all times.

I'd suggest making that we make a pass over the compiler to regularize things. Here are some IMHO suggestions for things that I find irritating on a daily basis. That said, it would make sense to propose these on swift-dev before producing any monster patches:

  • Rename things referring to source locations, but spelling out "Location" to use "Loc". E.g. getDebugLocation() -> getDebugLoc()

  • Rename MultipleValueInstruction, SingleValueInstruction to SingleValueInst/MultipleValueInst since most of SIL uses "Inst". SILInstruction was supposed to be the one longhand one.

  • There are lots of different ways to get the current ASTContext, but a getASTContext() member is the most common (and flexible, because sometimes it isn't stored). As such, we should change public "Context" members to a getASTContext() method.

  • Some Expr nodes are created with "new (ctx) Node(...)" and others are made with Node::create(... ctx). We should standardize on the create methods, since they are more flexible.

I'm sure there are lots more places we can improve things as well.

@swift-ci
Copy link
Collaborator

Comment by Ahmad Alhashemi (JIRA)

I will work on that.

@hartbit
Copy link
Collaborator

hartbit commented Apr 21, 2018

How about standardising on variable casing? I've seen both Capitalised and lowerCased variable names.

@belkadan
Copy link
Contributor

That one requires discussion to actually pick a convention, so let's leave it out of this bug for now.

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 3, 2020

Comment by Alberto Lagos (JIRA)

What is the status of this ticket? There is any conversation going on a proposal to apply these changes?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement
Projects
None yet
Development

No branches or pull requests

3 participants