[PATCH] D131386: [clang-tidy] Added `ConstAlignment` option to `misc-const-correctness`
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 15 04:54:10 PDT 2022
njames93 added a reviewer: Mordante.
njames93 added a comment.
In D131386#3722749 <https://reviews.llvm.org/D131386#3722749>, @aaron.ballman wrote:
> We leave formatting decisions in clang-tidy to clang-format and I don't think we should deviate from that policy here without a very clear understanding of when we should relax that restriction. That said, I'm personally not certain we should have such an option (the long-term goal has generally been to integrate clang-format functionality into clang-tidy so there can be an option to just run format after applying fixes in a TU). Is there a compelling reason we should have it?
The reason for this is due to the issue that `QualifierAlignment` is a non whitespace only change and clang-format lists that using it could break some code.
In light of this some users may wish to set the option to `QAS_Leave` to be sure no code is broken even though they would prefer a specific style.
Therefore having a dedicated option in the check will let those users specify the style, without having to set a clang-format configuration which they aren't content in using.
================
Comment at: clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp:66
+ ConstAlignment(
+ Options.get("ConstAlignment", utils::fixit::QualifierPolicy::Right)) {
if (AnalyzeValues == false && AnalyzeReferences == false)
----------------
Mordante wrote:
> I would suggest to use `QualifierAlignment` to match the name in clang-format.
I thought about that, but the clang-format option doesn't just align the const qualifier. It works for all qualifiers.
I am easy on what name we use for the option.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131386/new/
https://reviews.llvm.org/D131386
More information about the cfe-commits
mailing list