[pygccxml-commit] SF.net SVN: pygccxml: [1169] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-11-22 21:51:02
|
Revision: 1169 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1169&view=rev Author: roman_yakovenko Date: 2007-11-22 13:51:07 -0800 (Thu, 22 Nov 2007) Log Message: ----------- rename has_trivial_copy with has_copy_constructor to better reflect what function does Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/unittests/data/core_cache.hpp pygccxml_dev/unittests/data/type_traits.hpp pygccxml_dev/unittests/test_all.py pygccxml_dev/unittests/type_traits_tester.py Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-22 21:51:07 UTC (rev 1169) @@ -156,7 +156,8 @@ from type_traits import has_destructor from type_traits import has_public_less -from type_traits import has_trivial_copy +from type_traits import has_copy_constructor +has_trivial_copy = has_copy_constructor #backward comp mode will be removed from type_traits import has_public_equal from type_traits import has_public_assign from type_traits import has_public_destructor Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2007-11-22 21:51:07 UTC (rev 1169) @@ -406,25 +406,25 @@ to the term assignment operator. """ -def has_trivial_copy( type): +def has_copy_constructor( class_ ): """returns True, if class has public copy constructor, False otherwise""" - assert isinstance( type, class_declaration.class_t ) - if '0.9' in type.compiler: - copy_ = type.find_copy_constructor() + class_ = class_traits.get_declaration( class_ ) + if '0.9' in class_.compiler: + copy_ = class_.find_copy_constructor() if copy_: if copy_.access_type == 'public': return True else: return False else: - if type.constructors( recursive=False, allow_empty=True ): + if __contains_noncopyable_mem_var( class_ ): return False else: return True else: constructors = filter( lambda x: isinstance( x, calldef.constructor_t ) \ and x.is_copy_constructor - , type.public_members ) + , class_.public_members ) return bool( constructors ) def has_destructor(type): @@ -691,7 +691,7 @@ return True if isinstance( target, cpptypes.declarated_t ): assert isinstance( target.declaration, class_declaration.class_t ) - if has_trivial_copy( target.declaration ): + if has_copy_constructor( target.declaration ): return True #we have copy constructor return False @@ -704,7 +704,7 @@ return True if isinstance( target, cpptypes.declarated_t ): assert isinstance( target.declaration, class_declaration.class_t ) - if has_trivial_copy( target.declaration ): + if has_copy_constructor( target.declaration ): return True #we have copy constructor return False @@ -717,7 +717,7 @@ return True if isinstance( target, cpptypes.declarated_t ): assert isinstance( target.declaration, class_declaration.class_t ) - if has_trivial_copy( target.declaration ): + if has_copy_constructor( target.declaration ): return True #we have copy constructor return False @@ -730,7 +730,7 @@ return True if isinstance( target, cpptypes.declarated_t ): assert isinstance( target.declaration, class_declaration.class_t ) - if has_trivial_copy( target.declaration ): + if has_copy_constructor( target.declaration ): return True #we have copy constructor return False @@ -895,13 +895,13 @@ return True logger.debug( "__contains_noncopyable_mem_var - %s - false - doesn't contains noncopyable members" % class_.decl_string ) -def __is_noncopyable_single( class_ ): +def __is_noncopyable_single( class_): """implementation details""" #It is not enough to check base classes, we should also to check #member variables. logger = utils.loggers.cxx_parser - if has_trivial_copy( class_ ) \ + if has_copy_constructor( class_ ) \ and has_public_constructor( class_ ) \ and has_public_assign( class_ ) \ and has_public_destructor( class_ ): @@ -947,7 +947,7 @@ if base_desc.related_class.decl_string in ('::boost::noncopyable', '::boost::noncopyable_::noncopyable' ): logger.debug( true_header + "derives from boost::noncopyable" ) return True - if not has_trivial_copy( base_desc.related_class ): + if not has_copy_constructor( base_desc.related_class ): base_copy_ = base_desc.related_class.find_copy_constructor() if base_copy_: if base_copy_.access_type == 'private': @@ -961,7 +961,7 @@ logger.debug( true_header + "__is_noncopyable_single returned True" ) return True - if not has_trivial_copy( class_ ): + if not has_copy_constructor( class_ ): logger.debug( true_header + "does not have trival copy constructor" ) return True elif not has_public_constructor( class_ ): Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-11-22 21:51:07 UTC (rev 1169) @@ -485,11 +485,19 @@ return operator def __read_version(self, attrs): + logger = utils.loggers.cxx_parser + version = float( attrs.get(XML_AN_CVS_REVISION, 0.6) ) if version is None: + logger.info ( 'GCCXML version - 0.6' ) version = "0.6" - elif version < 1.117: + elif version <= 1.114: + logger.info ( 'GCCXML version - 0.7' ) version = "0.7" + elif version in ( 1.115, 1.116, 1.117 ): + logger.info ( 'GCCXML version - 0.9 BUGGY' ) + version = "0.9" else: + logger.info ( 'GCCXML version - 0.9' ) version = "0.9" self.__compiler = "GCC-XML " + version Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/unittests/data/core_cache.hpp 2007-11-22 21:51:07 UTC (rev 1169) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file Modified: pygccxml_dev/unittests/data/type_traits.hpp =================================================================== --- pygccxml_dev/unittests/data/type_traits.hpp 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/unittests/data/type_traits.hpp 2007-11-22 21:51:07 UTC (rev 1169) @@ -158,6 +158,20 @@ struct const_container{ const const_item items[10]; }; + enum semantic{ position, normal, binormal }; + enum element_type{ float_, color, short_ }; + + struct vertex{ + protected: + unsigned short source; + size_t offset; + semantic sem; + element_type el_type; + public: + vertex( int x, int y, int z ); + + bool operator==( const vertex& ) const; + }; } namespace yes{ @@ -178,6 +192,7 @@ typedef std::vector< int > vector_of_int_type; typedef std::set< std::string > string_set_type; typedef std::multimap< std::string, std::string > s2s_multimap_type; + typedef detail::vertex vertex_type; } } @@ -553,11 +568,12 @@ }; } } -namespace has_trivial_copy{ +namespace has_copy_constructor{ namespace yes{ struct x{ x(const x&){} }; + typedef is_noncopyable::detail::vertex vertex_type; } namespace no{ Modified: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/unittests/test_all.py 2007-11-22 21:51:07 UTC (rev 1169) @@ -47,6 +47,7 @@ import find_container_traits_tester import attributes_tester import type_as_exception_bug_tester +import copy_constructor_tester testers = [ decl_string_tester @@ -90,6 +91,7 @@ , find_container_traits_tester , attributes_tester , type_as_exception_bug_tester + , copy_constructor_tester ] def create_suite(): Modified: pygccxml_dev/unittests/type_traits_tester.py =================================================================== --- pygccxml_dev/unittests/type_traits_tester.py 2007-11-22 21:49:28 UTC (rev 1168) +++ pygccxml_dev/unittests/type_traits_tester.py 2007-11-22 21:51:07 UTC (rev 1169) @@ -126,8 +126,8 @@ def test_has_any_non_copyconstructor(self): self.__test_type_category( 'has_any_non_copyconstructor', declarations.has_any_non_copyconstructor) - def test_has_trivial_copy(self): - self.__test_type_category( 'has_trivial_copy', declarations.has_trivial_copy ) + def test_has_copy_constructor(self): + self.__test_type_category( 'has_copy_constructor', declarations.has_copy_constructor ) def test_is_base_and_derived(self): ns = declarations.find_declaration( self.declarations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |