cppclean
cppclean copied to clipboard
nameless node in AST
Hello,
cppclean crashes on a particular code. For some reasons, in the AST you end up with a node with "None" as name.
You can reproduce the bug easily:
>> wget https://raw.githubusercontent.com/victorprad/InfiniTAM/master/InfiniTAM/ITMLib/Engine/DeviceAgnostic/ITMVisualisationEngine.h
>> cppclean ITMVisualisationEngine.h
ITMVisualisationEngine.h:5: unable to find '../../Utils/ITMLibDefines.h'
Traceback (most recent call last):
File "/usr/bin/cppclean", line 145, in <module>
sys.exit(main())
File "/usr/bin/cppclean", line 138, in main
quiet=args.quiet):
File "/usr/lib/python2.7/site-packages/cpp/static_data.py", line 117, in run
_find_warnings(filename, lines, entire_ast, True) +
File "/usr/lib/python2.7/site-packages/cpp/static_data.py", line 64, in _find_warnings
print_warning(node)
File "/usr/lib/python2.7/site-packages/cpp/static_data.py", line 31, in print_warning
for name in node.name.split(','):
AttributeError: 'NoneType' object has no attribute 'split'
Cheers, Bruno
I believe it's same crash as in #113 . Please refer to my suggestion inside.