Преглед изворни кода

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

Chandler Carruth пре 12 година
родитељ
комит
96ad0e8b16
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      utils/sort_includes.py

+ 5 - 1
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