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

            Bug ID: 46555
           Summary: Clang-format does not de-duplicate indented #includes
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Usually, clang-format will de-duplicate #include directives.

However, on special inputs, it will not. This behavior is inconsistent.

STEPS TO REPRODUCE

1. Create a source:
cat >main.cpp <<__EOF__
#include <vector>
  #include <vector>

2. Run clang-format:
clang-format main.cpp

EXPECTED RESULTS

$ clang-format main.cpp
#include <vector>

ACTUAL RESULTS

$ clang-format main.cpp
#include <vector>
#include <vector>

ADDITIONAL INFORMATION

I am expecting headers to be de-duplicated, because the second pass actutally
eliminates duplicated includes:

$ clang-format main.cpp | clang-format --
#include <vector>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to