Skip to content

Commit 28e539d

Browse files
author
roman_yakovenko
committed
implement "abstract" property for PDB parser
1 parent b4d32f3 commit 28e539d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

pygccxml/declarations/class_declaration.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"""
1414

1515
import scopedef
16+
import itertools
1617
import compilers
1718
import algorithm
1819
import declaration
@@ -276,13 +277,28 @@ def recursive_derived(self):
276277

277278
def _get_is_abstract(self):
278279
if self.compiler == compilers.MSVC_PDB_9:
280+
#prevent cyclic dependencies
279281
import calldef
280-
import matchers #prevent cyclic dependencies
281-
m = matchers.virtuality_type_matcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL )
282-
if self.calldefs( m, recursive=False, allow_empty=True ):
282+
import function_traits
283+
from matchers import virtuality_type_matcher_t as vtmatcher_t
284+
filter_pv = vtmatcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL )
285+
if self.calldefs( filter_pv, recursive=False, allow_empty=True ):
283286
return True
287+
filter_npv = vtmatcher_t( calldef.VIRTUALITY_TYPES.VIRTUAL ) \
288+
| vtmatcher_t( calldef.VIRTUALITY_TYPES.NOT_VIRTUAL )
289+
pv_calldefs = []
290+
npv_calldefs = []
291+
292+
npv_calldefs.extend( self.calldefs( filter_npv, recursive=False, allow_empty=True ) )
284293
for base in self.recursive_bases:
285-
if base.related_class.calldefs( m, recursive=False, allow_empty=True ):
294+
cls = base.related_class
295+
pv_calldefs.extend( cls.calldefs( filter_pv, recursive=False, allow_empty=True ) )
296+
npv_calldefs.extend( cls.calldefs( filter_npv, recursive=False, allow_empty=True ) )
297+
298+
for pure_virtual in pv_calldefs:
299+
impl_found = filter( lambda f: function_traits.is_same_function( pure_virtual, f )
300+
, npv_calldefs )
301+
if not impl_found:
286302
return True
287303
return False
288304
else:

0 commit comments

Comments
 (0)