[all-commits] [llvm/llvm-project] adfe58: [clang-format] Minimize the damage caused by Align...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sat Mar 12 09:24:32 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: adfe58b09df957f8911c5e152daa9564e5931631
      https://github.com/llvm/llvm-project/commit/adfe58b09df957f8911c5e152daa9564e5931631
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2022-03-12 (Sat, 12 Mar 2022)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/lib/Format/WhitespaceManager.h
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Minimize the damage caused by AlignArrayOfStructures when working on non square arrays

I have lost count of the number of times this has been reported, but it fundamentally comes down to the fact that the "AlignArrayLeft/Right" function is fundamentally broken for non-square arrays.

As a result, a pointer can end up running off the end of the array structure, I've spent the last 2 weekends trying to rewrite this algorithm but I've struggled to get it aligned correctly.

This is an interim fix, that ignores all array that are non-square and leaves them alone. I think this can allow us to close out most of the crashes (if not all).

I think this can help reduce the number of bugs coming in that are duplicates.

https://github.com/llvm/llvm-project/issues/53748
https://github.com/llvm/llvm-project/issues/51767
https://github.com/llvm/llvm-project/issues/51277

Reviewed By: curdeius, HazardyKnusperkeks, feg208

Differential Revision: https://reviews.llvm.org/D121069




More information about the All-commits mailing list