[PATCH] D69764: [clang-format] Add Left/Right Const fixer capability
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 23 06:19:54 PDT 2020
aaron.ballman added a comment.
In D69764#2050226 <https://reviews.llvm.org/D69764#2050226>, @steveire wrote:
> I like the approach of using clang-format to implement this. It's much faster than a `clang-tidy` approach.
>
> The broader C++ community has already chosen `East`/`West` and it has momentum. If you choose `Left`/`Right` now, you will get pressure to add `East`/`West` in the future, which means we'll have the synonyms we want to avoid.
>
> The broader C++ community already has understanding of `East`/`West`. Trying to change that now should be out of scope for this patch. This patch should use `East`/`West`.
As a member of the C++ committee, I'm aware that any statements about what the broader C++ community understands are not to be taken too seriously; none of us know what ~5M people understand or don't.
I would like to reiterate my discomfort with using East/West as the identifiers here. The purpose to this functionality is to decide whether to put qualifiers before or after the base type -- use of east/west to describe relative locations like these is not idiomatic in the same way as left/right or before/after (e.g., I'm not east-handed and you don't put the cart to the west of the horse). Qualifiers have been in C++ for ~40 years and the notion of east/west terminology is a very recent evolution by comparison. Also, clang-format is not a formatter for C++ alone and the east/west terminology is likely even less-known to users of the other languages despite also having qualifiers that need formatting (e.g., C and Obj). I think these are valid technical concerns with the patch that we should not hand-wave away as matters of preference.
================
Comment at: clang/lib/Format/Format.cpp:2547
+ if (Style.isCpp() || Style.Language == FormatStyle::LK_ObjC) {
+ if (Style.ConstStyle != FormatStyle::CS_Leave)
----------------
This prevents us from using this in C code despite C having qualifiers that can go to the left or right of the base type but still allows you to use if from Objective-C. That seems incorrect.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69764/new/
https://reviews.llvm.org/D69764
More information about the cfe-commits
mailing list