[all-commits] [llvm/llvm-project] ffb48d: [clang-format] successive C# attributes cause line...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sat May 29 08:44:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ffb48d48e45c72ed81dda4983ccb06e800cdbbd0
      https://github.com/llvm/llvm-project/commit/ffb48d48e45c72ed81dda4983ccb06e800cdbbd0
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2021-05-29 (Sat, 29 May 2021)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTestCSharp.cpp

  Log Message:
  -----------
  [clang-format] successive C# attributes cause line breaking issues

{D74265} reduced the aggressiveness of line breaking following C# attributes, however this change removed any support for attributes on properties, causing significant ugliness to be introduced.

This revision goes some way to addressing that by re-introducing the more aggressive check to `mustBreakBefore()`, but constraining it to the most common cases where we use properties which should not impact the "caller info attributes"  or the "[In , Out]" decorations that are normally put on pinvoke

It does not address my additional concerns of the original change regarding multiple C# attributes, as these are somewhat incorrectly handled by virtue of the fact its not recognising the second attribute as an attribute at all. But instead thinking its an array.

The purpose of this revision is to get back to where we were for the most common of cases as a stepping stone to resolving this. However {D74265} has broken a lot of C# code and this revision will go someway alone to addressing the majority.

Reviewed By: jbcoe, HazardyKnusperkeks, curdeius

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




More information about the All-commits mailing list