]> granicus.if.org Git - clang/commit
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)
commit74b162155a972a6be71ff11bf057fb45c772f4d7
tree211cd749428b34efbf912709db285de668c31bbc
parentc2f48873daea4175e9e6ce18a3ab4551ebff5fed
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256148 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/Format.cpp
unittests/Format/SortIncludesTest.cpp