mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Add polly support to sort_includes.py
Changes: - Add "isl/" as a system library prefix. Even though isl is regularly imported into polly, it is still used like an external library. - Add "json/" as a system library prefix. Polly uses json-cpp as external library. - Distinguish between llvm and subproject libraries. Always sort subprojects before LLVM. This was already the case with clang, as 'clang' comes before 'llvm', but we also want 'polly' to be sorted before 'llvm'. The sorting of headers that are not part of Polly or isl remains unchanged. llvm-svn: 236929
This commit is contained in:
parent
8e0d983ad2
commit
051452f517
@ -29,7 +29,8 @@ def sort_includes(f):
|
|||||||
headers_end = 0
|
headers_end = 0
|
||||||
api_headers = []
|
api_headers = []
|
||||||
local_headers = []
|
local_headers = []
|
||||||
project_headers = []
|
subproject_headers = []
|
||||||
|
llvm_headers = []
|
||||||
system_headers = []
|
system_headers = []
|
||||||
for (i, l) in enumerate(lines):
|
for (i, l) in enumerate(lines):
|
||||||
if l.strip() == '':
|
if l.strip() == '':
|
||||||
@ -44,12 +45,16 @@ def sort_includes(f):
|
|||||||
api_headers.append(header)
|
api_headers.append(header)
|
||||||
look_for_api_header = False
|
look_for_api_header = False
|
||||||
continue
|
continue
|
||||||
if header.startswith('<') or header.startswith('"gtest/'):
|
if (header.startswith('<') or header.startswith('"gtest/') or
|
||||||
|
header.startswith('"isl/') or header.startswith('"json/')):
|
||||||
system_headers.append(header)
|
system_headers.append(header)
|
||||||
continue
|
continue
|
||||||
if (header.startswith('"llvm/') or header.startswith('"llvm-c/') or
|
if (header.startswith('"clang/') or header.startswith('"clang-c/') or
|
||||||
header.startswith('"clang/') or header.startswith('"clang-c/')):
|
header.startswith('"polly/')):
|
||||||
project_headers.append(header)
|
subproject_headers.append(header)
|
||||||
|
continue
|
||||||
|
if (header.startswith('"llvm/') or header.startswith('"llvm-c/')):
|
||||||
|
llvm_headers.append(header)
|
||||||
continue
|
continue
|
||||||
local_headers.append(header)
|
local_headers.append(header)
|
||||||
continue
|
continue
|
||||||
@ -65,9 +70,10 @@ def sort_includes(f):
|
|||||||
return
|
return
|
||||||
|
|
||||||
local_headers = sorted(set(local_headers))
|
local_headers = sorted(set(local_headers))
|
||||||
project_headers = sorted(set(project_headers))
|
subproject_headers = sorted(set(subproject_headers))
|
||||||
|
llvm_headers = sorted(set(llvm_headers))
|
||||||
system_headers = sorted(set(system_headers))
|
system_headers = sorted(set(system_headers))
|
||||||
headers = api_headers + local_headers + project_headers + system_headers
|
headers = api_headers + local_headers + subproject_headers + llvm_headers + system_headers
|
||||||
header_lines = ['#include ' + h for h in headers]
|
header_lines = ['#include ' + h for h in headers]
|
||||||
lines = lines[:headers_begin] + header_lines + lines[headers_end + 1:]
|
lines = lines[:headers_begin] + header_lines + lines[headers_end + 1:]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user