Skip to content

Commit

Permalink
Remove superflous declaration joining
Browse files Browse the repository at this point in the history
In commit cc4fbdc (so just before
version 1.7.0, for the first release working with CastXML), I added
this joining because it fixed a bug found by the
project_reader_correctness_tester test.

Now I realized that all the test still pass without that joining.
It is not clear what has changed: there may have been some code
changes in pygccxml that made that work; or more probably
the newer CastXML versions do not produce these weird files
with multiple declarations that need to be joined.

As the CastXML versions used for version 1.7.0 where pretty
experimental compared to the stable versions from nowadays,
I will just remove this block (e.g. I do not really support
these old castxml versions).

This change should slightly improve the processing speed
when parsing single files.
  • Loading branch information
iMichka committed Jan 5, 2017
1 parent 3d2b1ad commit d45d057
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
3 changes: 1 addition & 2 deletions pygccxml/parser/project_reader.py
Expand Up @@ -269,8 +269,7 @@ def __parse_file_by_file(self, files):
reader = source_reader.source_reader_t(
config,
self.__dcache,
self.__decl_factory,
join_decls=False)
self.__decl_factory)

if content_type == \
file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE:
Expand Down
14 changes: 1 addition & 13 deletions pygccxml/parser/source_reader.py
Expand Up @@ -62,7 +62,7 @@ class source_reader_t(object):
generated ids with references to declarations or type class instances.
"""

def __init__(self, config, cache=None, decl_factory=None, join_decls=True):
def __init__(self, config, cache=None, decl_factory=None):
"""
:param config: Instance of :class:`xml_generator_configuration_t`
class, that contains GCC-XML or CastXML configuration.
Expand All @@ -74,17 +74,11 @@ def __init__(self, config, cache=None, decl_factory=None, join_decls=True):
:param decl_factory: Declarations factory, if not given default
declarations factory( :class:`decl_factory_t` )
will be used.
:param join_decls: Skip the joining of the declarations for the file.
This can then be done once, in the case where
there are multiple files, for example in the
project_reader. Is True per default.
:type boolean
"""

self.logger = utils.loggers.cxx_parser
self.__join_decls = join_decls
self.__search_directories = []
self.__config = config
self.__cxx_std = utils.cxx_standard(config.cflags)
Expand Down Expand Up @@ -487,12 +481,6 @@ def __parse_xml_file(self, xml_file):
declarations.apply_visitor(linker_, decl)
bind_aliases(iter(decls.values()))

# Join declarations
if self.__join_decls:
for namespace in iter(decls.values()):
if isinstance(namespace, declarations.namespace_t):
self.join_declarations(namespace)

# some times gccxml report typedefs defined in no namespace
# it happens for example in next situation
# template< typename X>
Expand Down

0 comments on commit d45d057

Please sign in to comment.