[llvm-commits] [llvm] r169248 - /llvm/trunk/utils/sort_includes.py

Chandler Carruth chandlerc at gmail.com
Tue Dec 4 02:08:59 PST 2012


Author: chandlerc
Date: Tue Dec  4 04:08:59 2012
New Revision: 169248

URL: http://llvm.org/viewvc/llvm-project?rev=169248&view=rev
Log:
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.

Modified:
    llvm/trunk/utils/sort_includes.py

Modified: llvm/trunk/utils/sort_includes.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/sort_includes.py?rev=169248&r1=169247&r2=169248&view=diff
==============================================================================
--- llvm/trunk/utils/sort_includes.py (original)
+++ llvm/trunk/utils/sort_includes.py Tue Dec  4 04:08:59 2012
@@ -18,8 +18,12 @@
   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





More information about the llvm-commits mailing list