diff options
author | Brad King <brad.king@kitware.com> | 2016-04-29 14:53:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-04-29 17:58:54 (GMT) |
commit | e1c7747253ac71a5215dd32a910b62a1fd8c561a (patch) | |
tree | dd4f8bf9663bf7a64c01d9391c3559f7b419dcb7 /Tests/QtAutogen | |
parent | 180538c70634dd6dc7fc68b4afbc1cd288c5b5c6 (diff) | |
download | CMake-e1c7747253ac71a5215dd32a910b62a1fd8c561a.zip CMake-e1c7747253ac71a5215dd32a910b62a1fd8c561a.tar.gz CMake-e1c7747253ac71a5215dd32a910b62a1fd8c561a.tar.bz2 |
Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first). First
run `clang-format` with the config file:
---
SortIncludes: false
...
Commit the result temporarily. Then run `clang-format` again with:
---
SortIncludes: true
IncludeCategories:
- Regex: 'sys/types.h'
Priority: -1
...
Commit the result temporarily. Start a new branch and cherry-pick the
second commit. Manually resolve conflicts to preserve indentation of
re-ordered includes. This cleans up the include ordering without
changing any other style.
Use the following command to run `clang-format`:
$ git ls-files -z -- \
'*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
egrep -z -v '^Source/cm_sha2' |
egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
egrep -z -v '^Utilities/(KW|cm).*/' |
egrep -z -v '^Tests/Module/GenerateExportHeader' |
egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
xargs -0 clang-format -i
This selects source files that do not come from a third-party.
Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/Bdir/libB.h | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/calwidget.cpp | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/codeeditor.h | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/libC.h | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/main.cpp | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/resourcetester.cpp | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/same_name/ccc/item.cpp | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/same_name/main.cpp | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/Tests/QtAutogen/Bdir/libB.h b/Tests/QtAutogen/Bdir/libB.h index 510c17f..746b67a 100644 --- a/Tests/QtAutogen/Bdir/libB.h +++ b/Tests/QtAutogen/Bdir/libB.h @@ -4,8 +4,8 @@ #include "libb_export.h" -#include <QObject> #include "libA.h" +#include <QObject> class LIBB_EXPORT LibB : public QObject { diff --git a/Tests/QtAutogen/calwidget.cpp b/Tests/QtAutogen/calwidget.cpp index 5f59994..0e314cd 100644 --- a/Tests/QtAutogen/calwidget.cpp +++ b/Tests/QtAutogen/calwidget.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ + #include <QCalendarWidget> + #include <QCheckBox> #include <QComboBox> + #include <QDateEdit> #include <QGridLayout> - #include <QLabel> #include <QGroupBox> - #include <QCheckBox> - #include <QDateEdit> - #include <QCalendarWidget> + #include <QLabel> #include <QTextCharFormat> #include "calwidget.h" diff --git a/Tests/QtAutogen/codeeditor.h b/Tests/QtAutogen/codeeditor.h index 56e9e792..fd79a2a 100644 --- a/Tests/QtAutogen/codeeditor.h +++ b/Tests/QtAutogen/codeeditor.h @@ -41,8 +41,8 @@ #ifndef CODEEDITOR_H #define CODEEDITOR_H - #include <QPlainTextEdit> #include <QObject> + #include <QPlainTextEdit> class QPaintEvent; class QResizeEvent; diff --git a/Tests/QtAutogen/libC.h b/Tests/QtAutogen/libC.h index 4fb4a2c..6682576 100644 --- a/Tests/QtAutogen/libC.h +++ b/Tests/QtAutogen/libC.h @@ -4,8 +4,8 @@ #include "libc_export.h" -#include <QObject> #include "libB.h" +#include <QObject> class LIBC_EXPORT LibC : public QObject { diff --git a/Tests/QtAutogen/main.cpp b/Tests/QtAutogen/main.cpp index eb59665..1636cd4 100644 --- a/Tests/QtAutogen/main.cpp +++ b/Tests/QtAutogen/main.cpp @@ -41,16 +41,16 @@ #include <QCoreApplication> #include <QTimer> -#include "codeeditor.h" +#include "abc.h" +#include "blub.h" #include "calwidget.h" +#include "codeeditor.h" #include "foo.h" -#include "blub.h" +#include "libC.h" +#include "resourcetester.h" #include "sub/bar.h" -#include "abc.h" #include "xyz.h" #include "yaf.h" -#include "libC.h" -#include "resourcetester.h" #ifdef TEST_DEBUG_CLASS #include "debug_class.h" #include <iostream> diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp index 043ec75..75ae28f 100644 --- a/Tests/QtAutogen/resourcetester.cpp +++ b/Tests/QtAutogen/resourcetester.cpp @@ -1,8 +1,8 @@ #include "resourcetester.h" -#include <QDebug> #include <QApplication> +#include <QDebug> #include <QFile> #include <QTimer> diff --git a/Tests/QtAutogen/same_name/ccc/item.cpp b/Tests/QtAutogen/same_name/ccc/item.cpp index 2584881..12c71d0 100644 --- a/Tests/QtAutogen/same_name/ccc/item.cpp +++ b/Tests/QtAutogen/same_name/ccc/item.cpp @@ -22,5 +22,5 @@ MocTest::go() } // Include own moc files -#include "moc_item.cpp" #include "item.moc" +#include "moc_item.cpp" diff --git a/Tests/QtAutogen/same_name/main.cpp b/Tests/QtAutogen/same_name/main.cpp index 166466e..fc77a99 100644 --- a/Tests/QtAutogen/same_name/main.cpp +++ b/Tests/QtAutogen/same_name/main.cpp @@ -1,7 +1,7 @@ -#include "aaa/item.hpp" #include "aaa/bbb/item.hpp" -#include "bbb/item.hpp" +#include "aaa/item.hpp" #include "bbb/aaa/item.hpp" +#include "bbb/item.hpp" #include "ccc/item.hpp" int main(int argv, char **args) |