summaryrefslogtreecommitdiff
path: root/utils/sort_includes.py
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-12-04 10:08:59 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-12-04 10:08:59 +0000
commit96ad0e8b1635eb923ef5e9c79fef8b902960dfbb (patch)
treed105e954745df0be45e4959443de499e2c5d9958 /utils/sort_includes.py
parentfd025797ea5197b838f87ce57f2df5bccf27ad20 (diff)
downloadllvm-96ad0e8b1635eb923ef5e9c79fef8b902960dfbb.tar.gz
llvm-96ad0e8b1635eb923ef5e9c79fef8b902960dfbb.tar.bz2
llvm-96ad0e8b1635eb923ef5e9c79fef8b902960dfbb.tar.xz
Teach the include sorter to quickly skip files with an extension that
doesn't look like it will have C++ code in it. Suggestions on a better heuristic are welcome. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/sort_includes.py')
-rwxr-xr-xutils/sort_includes.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/sort_includes.py b/utils/sort_includes.py
index c1500f52e0..8ff7d059c4 100755
--- a/utils/sort_includes.py
+++ b/utils/sort_includes.py
@@ -18,8 +18,12 @@ def sort_includes(f):
if 'INPUTS/' in f.name or 'test/' in f.name:
return
+ ext = os.path.splitext(f.name)[1]
+ if ext not in ['.cpp', '.c', '.h', '.inc', '.def']:
+ return
+
lines = f.readlines()
- look_for_api_header = os.path.splitext(f.name)[1] == '.cpp'
+ look_for_api_header = ext in ['.cpp', '.c']
found_headers = False
headers_begin = 0
headers_end = 0