[pygccxml-commit] SF.net SVN: pygccxml: [1314] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-04-27 20:03:39
|
Revision: 1314 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1314&view=rev Author: roman_yakovenko Date: 2008-04-27 13:03:45 -0700 (Sun, 27 Apr 2008) Log Message: ----------- few small changes in pdb parser Modified Paths: -------------- pygccxml_dev/pygccxml/msvc/pdb/loader.py pygccxml_dev/unittests/core_tester.py pygccxml_dev/unittests/data/msvc_build/all.cpp pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj Modified: pygccxml_dev/pygccxml/msvc/pdb/loader.py =================================================================== --- pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-04-23 19:54:42 UTC (rev 1313) +++ pygccxml_dev/pygccxml/msvc/pdb/loader.py 2008-04-27 20:03:45 UTC (rev 1314) @@ -167,6 +167,8 @@ continue #in this case the parent scope is UDT ns_decl = declarations.namespace_t( name_splitter.name ) ns_decl.compiler = self.COMPILER + ns_decl.mangled = ns_decl.name + ns_decl.demangled = ns_decl.name parent_ns.adopt_declaration( ns_decl ) nss[ ns_name ] = ns_decl self.logger.debug( 'inserting ns "%s" into declarations tree - done', ns_name ) @@ -273,6 +275,31 @@ map( lambda smbl_id: self.symbols.pop( smbl_id ), to_be_deleted ) self.logger.info( 'clearing symbols(%d) - done', len( to_be_deleted ) ) + + def __normalize_name( self, decl ): + if decl.name == '<unnamed-tag>': + decl.name = '' + elif decl.name.startswith( '?' ): + decl.name = '' + elif isinstance( decl, declarations.namespace_t ) and 'anonymous-namespace' in decl.name: + decl.name = '' + else: + pass + + def __join_unnamed_nss( self, ns_parent ): + child_nss = ns_parent.namespaces( name='', recursive=False, allow_empty=True ) + if len(child_nss) > 1: + alive_ns = child_nss[0] + dead_nss = child_nss[1:] + for dead_ns in dead_nss: + decls = dead_ns.decls( recursive=False, allow_empty=True ) + map( dead_ns.remove_declaration, decls ) + map( alive_ns.adopt_declaration, decls ) + map( ns_parent.remove_declaration, dead_nss ) + map( self.__join_unnamed_nss + , ns_parent.namespaces( recursive=False, allow_empty=True ) ) + + def read(self): #self.__clear_symbols() self.__load_nss() @@ -281,6 +308,9 @@ self.__load_enums() self.__load_vars() self.__load_typedefs() + map( self.__normalize_name, self.global_ns.decls(recursive=True) ) + self.__join_unnamed_nss( self.global_ns ) + #join unnamed namespaces @property def dia_global_scope(self): @@ -460,7 +490,6 @@ self.logger.debug( 'creating typedef "%s" - done', smbl.uname ) return decl - def create_type( self, smbl ): #http://msdn2.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx if smbl.symIndexId in self.__types_cache: @@ -479,7 +508,7 @@ if 8 == smbl.length: my_type = declarations.long_long_int_t() elif 4 == smbl.length: - my_type = declarations.long_int_t() + my_type = declarations.int_t() #long_int_t elif 2 == smbl.length: my_type = declarations.short_int_t() else: @@ -506,7 +535,7 @@ elif enums.BasicType.btCurrency == smbl.baseType: my_type = declarations.unknown_t() elif enums.BasicType.btDate == smbl.baseType: - my_type = declarations.unknown_t() + my_type = declarations.double_t() elif enums.BasicType.btVariant == smbl.baseType: my_type = declarations.unknown_t() elif enums.BasicType.btComplex == smbl.baseType: @@ -516,7 +545,7 @@ elif enums.BasicType.btBSTR == smbl.baseType: my_type = declarations.unknown_t() elif enums.BasicType.btHresult == smbl.baseType: - my_type = declarations.unknown_t() + my_type = declarations.long_int_t() else: my_type = declarations.unknown_t() elif msdia.SymTagPointerType == smbl.symTag: @@ -526,11 +555,12 @@ else: my_type = declarations.pointer_t( base_type ) elif msdia.SymTagArrayType == smbl.symTag: - bytes = smbl.length - element_type = self.create_type( smbl.arrayIndexType ) + element_type = self.create_type( smbl.type ) size = declarations.array_t.SIZE_UNKNOWN - if bytes and element_type.byte_size: - size = bytes / element_type.byte_size + if smbl.count: + size = smbl.count + #~ if smbl.length and element_type.byte_size: + #~ size = smbl.length / element_type.byte_size my_type = declarations.array_t( element_type, size ) elif smbl.symTag in ( msdia.SymTagUDT, msdia.SymTagTypedef, msdia.SymTagEnum ): if smbl.symIndexId in self.__id2decl: Modified: pygccxml_dev/unittests/core_tester.py =================================================================== --- pygccxml_dev/unittests/core_tester.py 2008-04-23 19:54:42 UTC (rev 1313) +++ pygccxml_dev/unittests/core_tester.py 2008-04-27 20:03:45 UTC (rev 1314) @@ -84,7 +84,10 @@ def _test_class_membership( self, class_inst, enum_name, access ): #getting enum through get_members function - nested_enum1 = class_inst.enum( name=enum_name, function=access_type_matcher_t( access ) ) + if class_inst.compiler == compilers.MSVC_PDB_9: + nested_enum1 = class_inst.enum( name=enum_name ) + else: + nested_enum1 = class_inst.enum( name=enum_name, function=access_type_matcher_t( access ) ) #getting enum through declarations property nested_enum2 = class_inst.enum( enum_name ) @@ -180,7 +183,7 @@ if self.global_ns.compiler != compilers.MSVC_PDB_9: self.failIf( errors, pprint.pformat( errors ) ) else: - self.failUnless( 6 == len( errors ), pprint.pformat( errors ) ) + self.failUnless( 5 == len( errors ), pprint.pformat( errors ) ) def test_compound_types(self): typedef_inst = self.global_ns.decl( decl_type=typedef_t, name='typedef_const_int' ) Modified: pygccxml_dev/unittests/data/msvc_build/all.cpp =================================================================== --- pygccxml_dev/unittests/data/msvc_build/all.cpp 2008-04-23 19:54:42 UTC (rev 1313) +++ pygccxml_dev/unittests/data/msvc_build/all.cpp 2008-04-27 20:03:45 UTC (rev 1314) @@ -83,24 +83,36 @@ core::types::typedef_float typedef_float_; core::types::typedef_double typedef_double_; core::types::typedef_long_double typedef_long_double_; - + core::types::typedef_volatile_int typedef_volatile_int_; core::types::member_variable_ptr_t member_variable_ptr_ = 0; + core::types::typedef_EFavoriteDrinks typedef_EFavoriteDrinks_; } void use_core_ns_join_3(){ - E31 e31_; - ns::E32 e32_; - ns::ns32::E33 e33_; - ns::E34 e34_; -} + E31 e31_; + ns::E32 e32_; + ns::ns32::E33 e33_; + ns::E34 e34_; + + E11 e11_; + E21 e21_; + ns::E12 e12_; + ns::E22 e22_; + ns::ns12::E13 e13_; + ns::ns22::E23 e23_; +} + void use_coremembership(){ - namespace cm = core::membership; - int i = cm::enums_ns::WITHIN_NS_UNNAMED_ENUM; - i += cm::enums_ns::WITHIN_NS; - i += cm::WITHIN_UNNAMED_NS_UNNAMED_ENUM; - i += cm::WITHIN_UNNAMED_NS; - cm::class_for_nested_enums_t class_for_nested_enums_; - + namespace cm = core::membership; + int i = cm::enums_ns::WITHIN_NS_UNNAMED_ENUM; + i += cm::enums_ns::WITHIN_NS; + i += cm::WITHIN_UNNAMED_NS_UNNAMED_ENUM; + i += cm::WITHIN_UNNAMED_NS; + cm::class_for_nested_enums_t class_for_nested_enums_; + + i += ::GLOBAL_NS_UNNAMED_ENUM; + EGlobal eglobal_; + } Modified: pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj =================================================================== --- pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj 2008-04-23 19:54:42 UTC (rev 1313) +++ pygccxml_dev/unittests/data/msvc_build/msvc_build.vcproj 2008-04-27 20:03:45 UTC (rev 1314) @@ -78,7 +78,7 @@ /> <Tool Name="VCXDCMakeTool" - ValidateIntelliSense="false" + ValidateIntelliSense="true" OutputDocumentFile="" /> <Tool This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |