[all-commits] [llvm/llvm-project] 05bea5: [clang-format] [PR49298] Sort includes pass will s...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sun Dec 12 09:01:22 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 05bea533d1fc1bcd63ccb84df9d0edab9701ad70
      https://github.com/llvm/llvm-project/commit/05bea533d1fc1bcd63ccb84df9d0edab9701ad70
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2021-12-12 (Sun, 12 Dec 2021)

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

  Log Message:
  -----------
  [clang-format] [PR49298] Sort includes pass will sort inside raw strings

https://github.com/llvm/llvm-project/issues/48642

clang-format does not respect raw string literals when sorting includes

```
const char *RawStr = R"(
)";
```

Running clang-format over with SortIncludes enabled transforms this code to:

```
const char *RawStr = R"(
)";
```
The following code tries to minimize this impact during IncludeSorting, by treating R"( and )" as equivalent of // clang-format off/on

Reviewed By: HazardyKnusperkeks, curdeius

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

Fixes #48642




More information about the All-commits mailing list