code_size_compare: handle deleted files and new files properly

'Removed' and 'NotCreated' should be displayed in new and old column
respectively. The value of delta is reflected on change column. This
commit handles the corner cases properly.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-08-16 15:59:55 +08:00
parent 8a25e6fdb2
commit bc775c48c9

View File

@ -644,13 +644,15 @@ class CodeSizeGeneratorWithSize(CodeSizeGenerator):
delta = new_attr - old_attr
change_attr = '{0:{1}}'.format(delta, '+' if delta else '')
elif old_size:
new_attr = - old_size.__dict__[sect]
new_attr = 'Removed'
old_attr = old_size.__dict__[sect]
change_attr = 'Removed'
delta = - old_attr
change_attr = '{0:{1}}'.format(delta, '+' if delta else '')
elif new_size:
new_attr = new_size.__dict__[sect]
old_attr = 'NotCreated'
change_attr = 'None'
delta = new_attr
change_attr = '{0:{1}}'.format(delta, '+' if delta else '')
else:
# Should never happen
new_attr = 'Error'