-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index out of range #140
Comments
I'm getting this too. Cppclean gets about halfway through the GLM codebase before throwing this error. |
I'm seeing this too. I don't know what C++ code causes this to fail. It looks like https://github.com/myint/cppclean/blob/master/cpp/ast.py#L1097 |
I am attaching a sample cxx file. This reproduces the bug mentioned in this issue. |
I had the same problem. Trying to parse this code:
Throws:
Because you only skip those macros in https://github.com/myint/cppclean/blob/master/cpp/ast.py#L1093
And than you enter the self.get_name function with 'token_type' of 'PREPROCESSOR' which return an empty list and cabum - you're failing to get the first element and throws IndexError for trying to get index 0. A fix can be:
|
To avoid IndexError on tokens that has type PREPROCESSORS Fixing issue - Index out of range myint#140
To avoid IndexError on tokens that has type PREPROCESSORS Fixing issue - Index out of range #140
get_name() can return an empty list, see comment myint#140 (comment)
Fix issue 'Index out of range myint#140'
get_name() can return an empty list, see comment myint#140 (comment) (cherry picked from commit f8cbe5d)
get_name() can return an empty list, see comment myint#140 (comment) (cherry picked from commit rue-ryuzaki/cppclean@f8cbe5d)
get_name() can return an empty list, see comment myint#140 (comment) (cherry picked from commit rue-ryuzaki/cppclean@f8cbe5d)
I installed the latest master and I get the following error when running cppclean:
Traceback (most recent call last):
File "/usr/local/bin/cppclean", line 166, in
sys.exit(main())
File "/usr/local/bin/cppclean", line 139, in main
entire_ast = list([_f for _f in builder.generate() if _f])
File "/usr/local/lib/python2.7/dist-packages/cpp/ast.py", line 675, in generate
result = self._generate_one(token)
File "/usr/local/lib/python2.7/dist-packages/cpp/ast.py", line 753, in _generate_one
return self._get_method(temp_tokens, 0, None, False)
File "/usr/local/lib/python2.7/dist-packages/cpp/ast.py", line 1094, in _get_method
member = member[0]
IndexError: list index out of range
The text was updated successfully, but these errors were encountered: