[LLVMdev] RFC: variable names (original) (raw)

Rafael Espíndola rafael.espindola at gmail.com
Tue Oct 14 07:13:39 PDT 2014


On 13 October 2014 18:04, Nick Kledzik <kledzik at apple.com> wrote:

I’d like to discuss revising the LLVM coding conventions to change the naming of variables to start with a lowercase letter. This should not be a discussion on the pain of such a transition, or how to get from here to there, but rather, if there is a better place to be.

I don't think this is practical. We changed function naming and are still living with the pain of that change, so the process of how we change things has to be an integral part of this discussion.

My only real preference is consistency, so I will not vote on how we name variables. On the other hand, I do have a preference on how to change things if we decide to do it.

I think I have done my fair share of bug and blame/annotate hunting and I don't find the existing argument against large refactoring convincing. It is really easy to continue a git blame past a revision that refactored the line you are trying to find the origin:

  1. git blame foo.cpp
  2. find out that the line you are interested was modified in a refactoring revision abc123.
  3. git blame abc123^ foo.cpp

In the case of white space, it is even easier: git blame -w.

IMHO having consistent code also makes merges easier. Just format/edit both ends first and then merge.

We have also handled more complicated changes as a short series of patches. For example, the transition to std::error_code was done in 2 weeks instead of the multiple year pain of the function name change.

So, in the end my only request on this is: if we change the naming, lets write a clang-tidy tool to change the entire code base in a small patch series.

Cheers, Rafael



More information about the llvm-dev mailing list