CastXML / pygccxml

pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
Boost Software License 1.0
131 stars 45 forks source link

KeyError: (('/usr/include/c++/7/type_traits', 580), ('::', 'std', 'type')) #105

Open manuka89 opened 5 years ago

manuka89 commented 5 years ago

Hi there,

I have encountered the following error during the execution of pygccxml. If I launch castXML myself it sucessfully generates the XML file so I guess the issue comes from the parsing:

decls = parser.parse([filename], config)

File "/usr/lib/python2.7/site-packages/pygccxml/parser/init.py", line 51, in parse declarations = parser.read_files(files, compilation_mode) File "/usr/lib/python2.7/site-packages/pygccxml/parser/project_reader.py", line 264, in read_files return self.parse_file_by_file(files) File "/usr/lib/python2.7/site-packages/pygccxml/parser/project_reader.py", line 332, in parse_file_by_file leaved_classes = self._join_class_hierarchy(answer) File "/usr/lib/python2.7/site-packages/pygccxml/parser/project_reader.py", line 481, in _join_class_hierarchy derived_info.related_class)] KeyError: (('/opt/rh/devtoolset-7/root/usr/include/c++/7/type_traits', 580), ('::', 'std', 'type'))

I'm using clang 8.0, castXML 0.2 botuh compiled with GCC 7.3 on CentOS 7.6.

manuka89 commented 5 years ago

If I'm generating the xml file myself and then using the parse_xml_file function imported from "parser" I manage to parse the file.

manuka89 commented 5 years ago

By adding the flag compilation_mode=parser.COMPILATION_MODE.ALL_AT_ONCE to the parser it works as well with pygccxml

I'm trying to parse only one hpp file but it contains lots of template classes and other includes.

manuka89 commented 5 years ago

I was trying to figure it out the source of the issue but I have not managed it yet. Does somebody have an advice?

wzawisa commented 4 years ago

Did anyone have any luck solving this one? I am currently experiencing the same error trying to parse 2 C++ headers using cast XML and py++