This is an archive of the discontinued LLVM Phabricator instance.

Fix AttributeError in add_new_check.py
Needs ReviewPublic

Authored by j-carl on Mar 18 2020, 12:50 PM.

Details

Reviewers
alexfh
Summary

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'

Diff Detail

Event Timeline

j-carl created this revision.Mar 18 2020, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2020, 12:50 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
j-carl edited the summary of this revision. (Show Details)
j-carl added a project: Restricted Project.