This is an archive of the discontinued LLVM Phabricator instance.

Replace use of double underscore in identifiers
ClosedPublic

Authored by shafik on Feb 15 2022, 9:06 PM.

Details

Summary

Identifiers with __ anywhere are reserved. I picked this up via the bugprone-reserved-identifier clang-tidy check but -Wreserved-identifier will also flag these uses as well.

Diff Detail

Event Timeline

shafik requested review of this revision.Feb 15 2022, 9:06 PM
shafik created this revision.
labath accepted this revision.Feb 16 2022, 1:08 AM

Yeah, we shouldn't be using these. Personally, I think the names are now unnecessarily long, and I'd go with something shorter. E.g. replacing the double underscore (btw, in python land they abbreviate that to "dunder", so that would be another option) with a single (g_double_underscore_kCFBooleanFalse -> g_kCFBooleanFalse), but I don't think this is worth bikeshedding over.

lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
370

this line is now way above the length limit.

This revision is now accepted and ready to land.Feb 16 2022, 1:08 AM
shafik updated this revision to Diff 409344.Feb 16 2022, 11:27 AM

Used shorter options for renaming based on feedback.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 11:55 AM

Nice.

lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
261

This one also contains a double __?

Assuming all issues have been fixed, can you add this clang-tidy check to the .clang-tidy file in the root of the repository? That should make it less likely this regresses again in the future.