[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 12:07:59 PST 2024
================
@@ -144,7 +144,8 @@ void DefinitionBlockSeparator::separateBlocks(
return false;
if (const auto *Tok = OperateLine->First;
- Tok->is(tok::comment) && !isClangFormatOn(Tok->TokenText)) {
+ Tok->is(tok::comment) && parseClangFormatDirective(Tok->TokenText) ==
+ ClangFormatDirective::None) {
----------------
a-tarasyuk wrote:
@HazardyKnusperkeks Thank you for the review. I've made the changes. I extended the parsing of the directive because handling only On/Off doesn't fully address cases where we need to determine what the directive does to apply the appropriate formatting—such as disabling the next line, disabling the current line, or toggling an entire block. Does that make sense? I'd be happy to discuss alternative solutions if there's a better way to handle this.
Based on the discussions on the issue and this PR, where a clear consensus on these features hasn’t been reached. I’ve added a comment https://github.com/llvm/llvm-project/pull/118566#issuecomment-2531572587 - it might be best to hold off on these changes until a decision is made, on whether to move forward or close the issue entirely.
https://github.com/llvm/llvm-project/pull/118566
More information about the cfe-commits
mailing list