[clang-tools-extra] r246854 - [clang-tidy] Fix add_new_check.py.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 07:56:57 PDT 2015


Author: alexfh
Date: Fri Sep  4 09:56:57 2015
New Revision: 246854

URL: http://llvm.org/viewvc/llvm-project?rev=246854&view=rev
Log:
[clang-tidy] Fix add_new_check.py.

This fixes the case where the check should be added at the end of
the list of checks in CMakeLists.txt of the corresponding module.
Before it was added after LINK_LIBS line.

http://reviews.llvm.org/D12629

Patch by Marek Kurdej!

Modified:
    clang-tools-extra/trunk/clang-tidy/add_new_check.py

Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=246854&r1=246853&r2=246854&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Fri Sep  4 09:56:57 2015
@@ -34,9 +34,10 @@ def adapt_cmake(module_path, check_name_
     cpp_found = False
     file_added = False
     for line in lines:
-      if not file_added and (line.endswith('.cpp') or cpp_found):
+      cpp_line = line.endswith('.cpp')
+      if (not file_added) and (cpp_line or cpp_found):
         cpp_found = True
-        if line.strip() > cpp_file:
+        if (line.strip() > cpp_file) or (not cpp_line):
           f.write('  ' + cpp_file + '\n')
           file_added = True
       f.write(line + '\n')




More information about the cfe-commits mailing list