j-carl created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
j-carl added a reviewer: alexfh.
j-carl edited the summary of this revision.
j-carl added a project: clang-tools-extra.

Using add_new_check.py with Python 3.8.2 to create a new check results
in a AttributeError and an empty file <module>/<Module>TidyModule.cpp.

Python 3.x doesn't support `next()` anymore and should be replace with
`__next__()`.

$ ./add_new_check.py readability test-flag
Updating ./readability/CMakeLists.txt...
Creating ./readability/TestFlagCheck.h...
Creating ./readability/TestFlagCheck.cpp...
Updating ./readability/ReadabilityTidyModule.cpp...
Traceback (most recent call last):

  File "./add_new_check.py", line 471, in <module>
    main()
  File "./add_new_check.py", line 461, in main
    adapt_module(module_path, module, check_name, check_name_camel)
  File "./add_new_check.py", line 175, in adapt_module
    line = lines.next()

AttributeError: 'list_iterator' object has no attribute 'next'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76381

Files:
  clang-tools-extra/clang-tidy/add_new_check.py


Index: clang-tools-extra/clang-tidy/add_new_check.py
===================================================================
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -172,7 +172,7 @@
     lines = iter(lines)
     try:
       while True:
-        line = lines.next()
+        line = lines.__next__()
         if not header_added:
           match = re.search('#include "(.*)"', line)
           if match:
@@ -197,7 +197,7 @@
                 # If we didn't find the check name on this line, look on the
                 # next one.
                 prev_line = line
-                line = lines.next()
+                line = lines.__next__()
                 match = re.search(' *"([^"]*)"', line)
                 if match:
                   current_check_name = match.group(1)


Index: clang-tools-extra/clang-tidy/add_new_check.py
===================================================================
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -172,7 +172,7 @@
     lines = iter(lines)
     try:
       while True:
-        line = lines.next()
+        line = lines.__next__()
         if not header_added:
           match = re.search('#include "(.*)"', line)
           if match:
@@ -197,7 +197,7 @@
                 # If we didn't find the check name on this line, look on the
                 # next one.
                 prev_line = line
-                line = lines.next()
+                line = lines.__next__()
                 match = re.search(' *"([^"]*)"', line)
                 if match:
                   current_check_name = match.group(1)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to