[clang-tools-extra] r246494 - Help the clang-tidy helper script to understand C files better.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 14:53:55 PDT 2015


Author: aaronballman
Date: Mon Aug 31 16:53:55 2015
New Revision: 246494

URL: http://llvm.org/viewvc/llvm-project?rev=246494&view=rev
Log:
Help the clang-tidy helper script to understand C files better.

Modified:
    clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py

Modified: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py?rev=246494&r1=246493&r2=246494&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py (original)
+++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py Mon Aug 31 16:53:55 2015
@@ -38,12 +38,16 @@ def main():
     sys.exit('Not enough arguments.')
 
   input_file_name = sys.argv[1]
+  extension = '.cpp'
+  if (input_file_name.endswith('.c')):
+    extension = '.c'
+    
   check_name = sys.argv[2]
-  temp_file_name = sys.argv[3] + '.cpp'
+  temp_file_name = sys.argv[3] + extension
 
   clang_tidy_extra_args = sys.argv[4:]
   if len(clang_tidy_extra_args) == 0:
-    clang_tidy_extra_args = ['--', '--std=c++11']
+    clang_tidy_extra_args = ['--', '--std=c++11'] if extension == '.cpp' else ['--']
 
   with open(input_file_name, 'r') as input_file:
     input_text = input_file.read()




More information about the cfe-commits mailing list