[flang] Improve include file sorting.

Includes like "../dir/file.h" should sort after local includes.
This change fixes that and applies the new formatting.

Now the order (in reverse) is:
- system includes
- includes from llvm or clang (this is from the default IncludeCategories)
- includes of ../something
- everything else

Original-commit: flang-compiler/f18@324643d63a
Reviewed-on: https://github.com/flang-compiler/f18/pull/52
This commit is contained in:
Tim Keith 2018-04-12 12:23:20 -07:00
parent 11e278b83c
commit 6c772ac40b
12 changed files with 26 additions and 19 deletions

View File

@ -12,6 +12,15 @@ AlignTrailingComments: false
ConstructorInitializerIndentWidth: 2
SpaceAfterTemplateKeyword: false
SpacesBeforeTrailingComments: 2
IncludeCategories:
- Regex: '^<'
Priority: 4
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 3
- Regex: '^"\.\./'
Priority: 2
- Regex: '.*'
Priority: 1
...
# vim:set filetype=yaml:

View File

@ -1,8 +1,8 @@
#ifndef FORTRAN_LABEL_TABLE_H_
#define FORTRAN_LABEL_TABLE_H_
#include <stack>
#include <cassert>
#include <stack>
namespace Fortran::semantics {

View File

@ -7,11 +7,10 @@
#include "../parser/parse-tree-visitor.h"
#include "../parser/parse-tree.h"
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <string>
namespace Fortran::semantics {

View File

@ -1,5 +1,5 @@
#include "../parser/idioms.h"
#include "attr.h"
#include "../parser/idioms.h"
#include <stddef.h>
namespace Fortran {

View File

@ -1,8 +1,8 @@
#ifndef FORTRAN_ATTR_H_
#define FORTRAN_ATTR_H_
#include "../parser/idioms.h"
#include "enum-set.h"
#include "../parser/idioms.h"
#include <cinttypes>
#include <iostream>
#include <string>

View File

@ -1,7 +1,6 @@
#include "make-types.h"
#include "attr.h"
#include "type.h"
#include "../parser/idioms.h"
#include "../parser/parse-tree-visitor.h"
#include "../parser/parse-tree.h"

View File

@ -1,10 +1,10 @@
#include "../parser/indirection.h"
#include "../parser/parse-tree-visitor.h"
#include "../parser/parse-tree.h"
#include "attr.h"
#include "scope.h"
#include "symbol.h"
#include "type.h"
#include "../parser/indirection.h"
#include "../parser/parse-tree-visitor.h"
#include "../parser/parse-tree.h"
#include <iostream>
#include <list>
#include <memory>

View File

@ -1,10 +1,10 @@
#ifndef FORTRAN_SEMANTICS_SCOPE_H_
#define FORTRAN_SEMANTICS_SCOPE_H_
#include "../parser/idioms.h"
#include "../parser/parse-tree.h"
#include "attr.h"
#include "symbol.h"
#include "../parser/idioms.h"
#include "../parser/parse-tree.h"
#include <list>
#include <map>
#include <string>

View File

@ -1,6 +1,6 @@
#include "symbol.h"
#include "../parser/idioms.h"
#include "scope.h"
#include "../parser/idioms.h"
#include <memory>
namespace Fortran::semantics {

View File

@ -1,9 +1,9 @@
#ifndef FORTRAN_TYPE_H_
#define FORTRAN_TYPE_H_
#include "attr.h"
#include "../parser/idioms.h"
#include "../parser/parse-tree.h"
#include "attr.h"
#include <list>
#include <map>
#include <memory>

View File

@ -2,8 +2,8 @@
#include "../../lib/parser/characters.h"
#include "../../lib/parser/message.h"
#include "../../lib/parser/parse-tree.h"
#include "../../lib/parser/parse-tree-visitor.h"
#include "../../lib/parser/parse-tree.h"
#include "../../lib/parser/parsing.h"
#include "../../lib/parser/provenance.h"
#include "../../lib/parser/unparse.h"
@ -15,11 +15,11 @@
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <stdlib.h>
#include <unistd.h>
#include <string>
#include <sys/wait.h>
#include <unistd.h>
#include <vector>
static std::list<std::string> argList(int argc, char *const argv[]) {
std::list<std::string> result;

View File

@ -6,8 +6,8 @@
#include <list>
#include <optional>
#include <sstream>
#include <string>
#include <stddef.h>
#include <string>
using namespace Fortran;
using namespace parser;