clang-format: Extend detection of the "main" #include to use the filename
authorDaniel Jasper <djasper@google.com>
Mon, 21 Dec 2015 12:14:17 +0000 (12:14 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 21 Dec 2015 12:14:17 +0000 (12:14 +0000)
commit0bfdeb4b6dee9df4f165a2524c0fa8588a28e9f8
tree0d394ddb205f53b76c43b2778959199ccae2ea67
parentfde63cad6b7c179948377bf07e54f5809b0a832a
clang-format: Extend detection of the "main" #include to use the filename

Before, the first (non-system) header in a file was considered to be
the main include. This is conservative as it makes clang-format change
the #include order less often. Instead implement some basic usage of
the filename itself. With this patch, clang-format considers every
header to be a main include if the header file's basename is a prefix
to the filename the #include is in.

llvm-svn: 256148
clang/lib/Format/Format.cpp
clang/unittests/Format/SortIncludesTest.cpp