[all-commits] [llvm/llvm-project] 95403b: Apply format only if --format is specified (#79466)

Dmitry Polukhin via All-commits all-commits at lists.llvm.org
Mon Feb 5 02:00:30 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95403b42da0de500f4f86add7a60b0daf8ec98d0
      https://github.com/llvm/llvm-project/commit/95403b42da0de500f4f86add7a60b0daf8ec98d0
  Author: Dmitry Polukhin <34227995+dmpolukhin at users.noreply.github.com>
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
    M clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/test/clang-apply-replacements/Inputs/format_header/no.cpp
    A clang-tools-extra/test/clang-apply-replacements/Inputs/format_header/no.yaml
    A clang-tools-extra/test/clang-apply-replacements/Inputs/format_header/yes.cpp
    A clang-tools-extra/test/clang-apply-replacements/Inputs/format_header/yes.yaml
    A clang-tools-extra/test/clang-apply-replacements/format-header.cpp

  Log Message:
  -----------
  Apply format only if --format is specified (#79466)

clang-apply-replacements used to apply format even without --format is
specified. This because, methods like createReplacementsForHeaders only
takes the Spec.Style and would re-order the headers even when it was not
requested. The fix is to set up Spec.Style only if --format is provided.

Also added note to ReleaseNotes.rst

Based on https://github.com/llvm/llvm-project/pull/70801

---------

Co-authored-by: Kugan <34810920+kuganv at users.noreply.github.com>
Co-authored-by: Aaron Ballman <aaron at aaronballman.com>




More information about the All-commits mailing list