[all-commits] [llvm/llvm-project] 95bf0a: [clang-format] Don't break block comments when sor...

Marek Kurdej via All-commits all-commits at lists.llvm.org
Mon Jan 31 23:51:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95bf0a9ebdb4ee6f78699e20751602c8c3c5733f
      https://github.com/llvm/llvm-project/commit/95bf0a9ebdb4ee6f78699e20751602c8c3c5733f
  Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M clang/lib/Format/Format.cpp
    M clang/unittests/Format/SortIncludesTest.cpp

  Log Message:
  -----------
  [clang-format] Don't break block comments when sorting includes.

Fixes https://github.com/llvm/llvm-project/issues/34626.

Before, the include sorter would break the code:
```
#include <stdio.h>
#include <stdint.h> /* long
                       comment */
```
and change it into:
```
#include <stdint.h> /* long
#include <stdio.h>
                       comment */
```

This commit handles only the most basic case of a single block comment on an include line, but does not try to handle all the possible edge cases with multiple comments.

Reviewed By: HazardyKnusperkeks

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




More information about the All-commits mailing list