@@ -77,7 +77,7 @@ def erase_call(self, cls_name):
77
77
78
78
def no_std (self , cls_name ):
79
79
return self .decorated_call_prefix (
80
- cls_name , 'std::' , self .erase_call )
80
+ cls_name , 'std::' + utils . get_tr1 ( cls_name ) , self .erase_call )
81
81
82
82
def no_stdext (self , cls_name ):
83
83
return self .decorated_call_prefix (
@@ -403,32 +403,42 @@ def get_container_or_none(self, type_):
403
403
cls_declaration = type_
404
404
else :
405
405
utils .loggers .queries_engine .debug (
406
- "Container traits: returning None, type not known" )
406
+ "Container traits: returning None, type not known\n " )
407
407
return
408
408
409
409
if not cls_declaration .name .startswith (self .name () + '<' ):
410
410
utils .loggers .queries_engine .debug (
411
411
"Container traits: returning None, " +
412
- "declaration starts with " + self .name () + '<' )
412
+ "declaration starts with " + self .name () + '<\n ' )
413
413
return
414
414
415
+ # When using libstd++, some container traits are defined in
416
+ # std::tr1::. See remove_template_defaults_tester.py.
417
+ # In this case the is_defined_in_xxx test needs to be done
418
+ # on the parent
415
419
decl = cls_declaration
416
- if isinstance (type_ , cpptypes .declarated_t ):
420
+ if isinstance (type_ , class_declaration .class_declaration_t ):
421
+ is_ns = isinstance (type_ .parent , namespace .namespace_t )
422
+ if is_ns and type_ .parent .name == "tr1" :
423
+ decl = cls_declaration .parent
424
+ elif isinstance (type_ , cpptypes .declarated_t ):
417
425
is_ns = isinstance (type_ .declaration .parent , namespace .namespace_t )
418
426
if is_ns and type_ .declaration .parent .name == "tr1" :
419
- # When using libstd++, some container traits are defined in
420
- # std::tr1:: . See remove_template_defaults_tester.py.
421
- # In this case the is_defined_in_xxx test needs to be done
422
- # on the parent
423
427
decl = cls_declaration .parent
424
428
425
429
for ns in std_namespaces :
426
430
if type_traits .impl_details .is_defined_in_xxx (ns , decl ):
431
+ utils .loggers .queries_engine .debug (
432
+ "Container traits: get_container_or_none() will return " +
433
+ cls_declaration .name )
434
+ # The is_defined_in_xxx check is done on decl, but we return
435
+ # the original declation so that the rest of the algorithm
436
+ # is able to work with it.
427
437
return cls_declaration
428
438
429
439
# This should not happen
430
440
utils .loggers .queries_engine .debug (
431
- "Container traits: get_container_or_none() will return None" )
441
+ "Container traits: get_container_or_none() will return None\n " )
432
442
433
443
def is_my_case (self , type_ ):
434
444
"""
@@ -689,6 +699,8 @@ def find_container_traits(cls_or_string):
689
699
name = templates .name (cls_or_string )
690
700
if name .startswith ('std::' ):
691
701
name = name [len ('std::' ):]
702
+ if name .startswith ('std::tr1::' ):
703
+ name = name [len ('std::tr1::' ):]
692
704
for cls_traits in container_traits :
693
705
if cls_traits .name () == name :
694
706
return cls_traits
0 commit comments