[llvm-dev] RFC: changing variable naming rules in LLVM codebase & git-blame

Nicolai Hähnle-Montoro via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 3 05:15:54 PDT 2019


On Tue, Jul 30, 2019 at 11:51 AM Rui Ueyama via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>> Rui, what are your thoughts on next steps?  LLDB seems like a logical step, particularly because it uses its own naming convention that is completely unlike the rest of the project.
>
> Besides sending a new RFC, I think the next step is to improve a tool so that a sweeping change can be created mechanically. I was actually trying to improve clang-tidy for the variable renaming; clang-tidy already has a feature to rename identifiers, but that doesn't work well for our purposes in various corner cases, and because of the size of the repository, there are lots of corner cases, so I need to improve it. Once the tool is done, I'd try to apply the tool to the *entire* repo to rename everything all at once to see if such change is feasible. If it's feasible, I'd think that's probably better for everybody including downstream repo maintainers.

Agreed on the necessity of creating such a sweeping change
mechanically, and for the tool to work robustly.

The one giant concern here is disruption for people doing longer-term
work on branches of LLVM. There are basically two models that I'm
aware of people using:

1. Have a "local" branch with regular `git merge`s from "master".
2. Have a "local" branch which is regularly `git rebase`d on top of "master".

In both cases, commits may be cherry-picked to master.

*If* the rename tool is robustly enough, these workflows can probably
be accommodated. For example, for the rebase workflow, you currently
have:

  M1 -> M2 -> (M3) -> L1 -> L2 -> L3

where M3 is the tip of master. After applying the rename on master, you get:

  M1 -> M2 -> M3 -> R(M3)
                \
                 -> L1 -> L2 -> L3

By applying the rename to all trees in the local branch, it should be
possible to generate a "smarter rebase" of the form:

  M1 -> M2 -> M3 -> R(M3) -> R(L1) -> R(L2) -> R(L3)

I don't know if tools already exist to facilitate this, but I'd
consider it a necessary precondition for making such a major change.


> But all in all, the next logical step is to start a new thread with a concrete proposal how we'd like to rename identifiers and how we'd like to do that, to get a more concrete consensus and address concerns.

Agreed.

Cheers,
Nicolai
-- 
Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.


More information about the llvm-dev mailing list