[cfe-dev] Identifier naming inconsistencies in clang

via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 12 07:21:00 PST 2022


Some naming violations are deliberate; this is particularly true in llvm/include/ADT, where many classes define methods that intentionally follow the snake_case conventions used by STL.  Those should not be changed.

You should feel empowered to update the conventions for code you are working on for other reasons (as separate NFC changes and not requiring a pre-commit review).  But going through the entire project to update the conventions would probably be viewed as unnecessary churn, and potentially making life more difficult for people working on those areas.
--paulr

From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of Craig Topper via cfe-dev
Sent: Tuesday, January 11, 2022 6:21 PM
To: clang developer list <cfe-dev at lists.llvm.org>; Richard <legalize at xmission.com>
Subject: Re: [cfe-dev] Identifier naming inconsistencies in clang

The coding guidelines here https://llvm.org/docs/CodingStandards.html#introduction<https://urldefense.com/v3/__https:/llvm.org/docs/CodingStandards.html*introduction__;Iw!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpJ-EmSwWw$> say

"There are some conventions that are not uniformly followed in the code base (e.g. the naming convention). This is because they are relatively new, and a lot of code was written before they were put in place. Our long term goal is for the entire codebase to follow the convention, but we explicitly do not want patches that do large-scale reformatting of existing code. On the other hand, it is reasonable to rename the methods of a class if you’re about to change it in some other way. Please commit such changes separately to make code review easier."

But it has said that for a long time so I don't know what the feeling is these days.

~Craig


On Tue, Jan 11, 2022 at 3:17 PM Richard via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
Hi Team,

So... my IDE has settings to recognize identifier naming conventions
and it's constantly flagging various bits of clang code as not
following the convention, typically:

- Methods/functions that don't begin with lower-case letter
- Variables that don't begin with upper-case character
- Occasionally methods/variables using underscores as word separators

Is it acceptable to submit NFC refactoring changes that address the
inconsistencies or does it require a phabricator review?

Thanks,

-- Richard

--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline<https://urldefense.com/v3/__http:/tinyurl.com/d3d-pipeline__;!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpLCG0k1CA$>>
             The Terminals Wiki <http://terminals-wiki.org<https://urldefense.com/v3/__http:/terminals-wiki.org__;!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpKUVFRrCw$>>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org<https://urldefense.com/v3/__http:/ComputerGraphicsMuseum.org__;!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpJkxQvkhA$>>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com<https://urldefense.com/v3/__http:/LegalizeAdulthood.wordpress.com__;!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpKHhDdBZQ$>>
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<https://urldefense.com/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev__;!!JmoZiZGBv3RvKRSx!plX2V6Sh1Q1DDcjU0neKw87KXeMaAMufGIhGCZ5exEQu11bFNeBxI6RgKpKP_DwPZw$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20220112/aa090205/attachment-0001.html>


More information about the cfe-dev mailing list