MCPcopy Index your code
hub / github.com/KhronosGroup/Vulkan-Docs / deprecationComment

Method deprecationComment

scripts/generator.py:598–631  ·  view source on GitHub ↗

If an API element is marked deprecated, return a brief comment describing why. Otherwise, return an empty string. - elem - Element of the API. API name is determined depending on the element tag. - indent - number of spaces to indent the comment

(self, elem, indent = 0)

Source from the content-addressed store, hash-verified

596 return False;
597
598 def deprecationComment(self, elem, indent = 0):
599 """If an API element is marked deprecated, return a brief comment
600 describing why.
601 Otherwise, return an empty string.
602
603 - elem - Element of the API.
604 API name is determined depending on the element tag.
605 - indent - number of spaces to indent the comment"""
606
607 reason = elem.get('deprecated')
608
609 # This is almost always the path taken.
610 if reason == None:
611 return ''
612
613 # There is actually a deprecated attribute.
614 padding = indent * ' '
615
616 # Determine the API name.
617 if elem.tag == 'member' or elem.tag == 'param':
618 name = elem.find('.//name').text
619 else:
620 name = elem.get('name')
621
622 if reason == 'aliased':
623 return f'{padding}// {name} is a legacy alias\n'
624 elif reason == 'unused':
625 return f'{padding}// {name} is legacy and not used\n'
626 elif reason == 'true':
627 return f'{padding}// {name} is legacy, but no reason was given in the API XML\n'
628 else:
629 # This can be caught by schema validation
630 self.logMsg('error', f"{name} has an unknown legacy attribute value '{reason}'")
631 exit(1)
632
633 def buildEnumCDecl(self, expand, groupinfo, groupName):
634 """Generate the C declaration for an enum"""

Callers 9

buildEnumCDecl_EnumMethod · 0.95
genTypeMethod · 0.80
genStructBodyMethod · 0.80
genStructMethod · 0.80
genEnumMethod · 0.80
genTypeMethod · 0.80
genStructMethod · 0.80
genEnumMethod · 0.80

Calls 2

logMsgMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected