HomePhabricator

[clang-format] Switch to case-insensitive header matching and use it to improveā€¦

Authored by chandlerc on Jun 29 2017, 4:20 PM.

Description

[clang-format] Switch to case-insensitive header matching and use it to improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sorting:

  • We have gmock headers now, so it adds support for those to one of the categories.
  • LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that suffix for finding a main header.
  • At times the test file's case may not match the header file's case, so switch to case-insensitive regex matching of header names.

With this set of changes, I can't spot any misbehaviors when re-sorting
all of LLVM's unittest '#include' lines.

Thanks to Eric and Daniel for help testing and refining the patch during
review!

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

llvm-svn: 306759