llvm-capstone/clang/test/Format/remove-duplicate-includes.cpp
Eric Liu a992afe809 Make clang-format remove duplicate headers when sorting #includes.
Summary: When sorting #includes, #include directives that have the same text will be deduplicated when sorting #includes, and only the first #include in the duplicate #includes remains. If the `Cursor` is provided and put on a deleted #include, it will be put on the remaining #include in the duplicate #includes.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 278206
2016-08-10 09:32:23 +00:00

15 lines
345 B
C++

// RUN: grep -Ev "// *[A-Z-]+:" %s \
// RUN: | clang-format -style="{BasedOnStyle: LLVM, SortIncludes: true}" -lines=1:5 \
// RUN: | FileCheck -strict-whitespace %s
// CHECK: {{^#include\ <a>$}}
#include <a>
// CHECK: {{^#include\ <b>$}}
#include <b>
#include <a>
#include <b>
#include <b>
{
// CHECK: {{^\ \ int x\ \ ;$}}
int x ;
}