[llvm-bugs] [Bug 47634] New: [clang-format] Sorting duplicated includes produces invalid code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 24 00:26:27 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47634

            Bug ID: 47634
           Summary: [clang-format] Sorting duplicated includes produces
                    invalid code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: curdeius at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

When trying to test bug #46555, I've tested this code:

```
#include <array>
#include <array>
#include <vector>
#include <vector>

```

with .clang-format being just:
```
SortIncludes: true
```

Clang-format produces invalid code:
```
#include <array>
#include <#include <vector>
```

It happens only though when invoked from VSCode extension (which probably
passes offsets). I'll update the report when I get the full command line.

All versions from at least 7.1.0 until at least post-11.0.0 trunk from
2020-09-22 (clang-format version 12.0.0 (git at github.com:llvm/llvm-project.git
7bc3c860a75fc69e0eea0d3ea8233b363304de9a)) are affected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200924/24b626f2/attachment.html>


More information about the llvm-bugs mailing list