From 54f71cd72cb6e50ca72004aba80ff1d94f4a6a5a Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Mon, 2 May 2016 15:42:32 -0400
Subject: [PATCH] Source: Sort includes the way clang-format would

Re-apply the approach from commit e1c77472 (Format include directive
blocks and ordering with clang-format, 2016-04-29) but this time be
more careful about exclusion of parser generator sources:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '^Source/cmCommandArgumentLexer\.' |
      egrep -z -v '^Source/cmCommandArgumentParser\.' |
      egrep -z -v '^Source/cmDependsJavaLexer\.' |
      egrep -z -v '^Source/cmDependsJavaParser\.' |
      egrep -z -v '^Source/cmExprLexer\.' |
      egrep -z -v '^Source/cmExprParser\.' |
      egrep -z -v '^Source/cmFortranLexer\.' |
      egrep -z -v '^Source/cmFortranParser\.' |
      egrep -z -v '^Source/cmListFileLexer\.' |
      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

Also drop use of custom sorting for `sys/types.h`.
---
 Source/CPack/WiX/cmWIXPatchParser.h      | 2 +-
 Source/cmCommandArgumentParserHelper.cxx | 4 ++--
 Source/cmDependsJavaParserHelper.cxx     | 2 +-
 Source/cmExprParserHelper.cxx            | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index 42c0787f82..8ce4026ba0 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -17,8 +17,8 @@
 
 #include <cmXMLParser.h>
 
-#include <map>
 #include <list>
+#include <map>
 
 struct cmWIXPatchNode
 {
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 15ab74609b..0b2fd81eb6 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -11,10 +11,10 @@
 ============================================================================*/
 #include "cmCommandArgumentParserHelper.h"
 
-#include "cmSystemTools.h"
 #include "cmMakefile.h"
-#include "cmState.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
 
 #include "cmCommandArgumentLexer.h"
 
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 3c02325745..51a1cb4c5b 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -11,8 +11,8 @@
 ============================================================================*/
 #include "cmDependsJavaParserHelper.h"
 
-#include "cmSystemTools.h"
 #include "cmDependsJavaLexer.h"
+#include "cmSystemTools.h"
 #include <cmsys/FStream.hxx>
 
 int cmDependsJava_yyparse( yyscan_t yyscanner );
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index 6016c4cce3..c5ecde422c 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -11,8 +11,8 @@
 ============================================================================*/
 #include "cmExprParserHelper.h"
 
-#include "cmSystemTools.h"
 #include "cmMakefile.h"
+#include "cmSystemTools.h"
 
 #include "cmExprLexer.h"
 
-- 
GitLab