scripts: size_report: recognize C++ file extensions

This adds some common C++ file extensions so the script
can recognize those as source file, and display them in
different color.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-05-10 15:13:39 -07:00 committed by Carles Cufí
commit 1e8f6be1fd

View file

@ -47,6 +47,8 @@ SHF_ALLOC_EXEC = SHF_ALLOC | SHF_EXEC
DT_LOCATION = re.compile(r"\(DW_OP_addr: ([0-9a-f]+)\)")
SRC_FILE_EXT = ('.h', '.c', '.hpp', '.cpp', '.hxx', '.cxx', '.c++')
def get_symbol_addr(sym):
"""Get the address of a symbol"""
@ -599,7 +601,7 @@ def print_any_tree(root, total_size, depth):
if not row.node.children:
cc = Fore.CYAN
cr = Fore.RESET
elif row.node.name.endswith(".c") or row.node.name.endswith(".h"):
elif row.node.name.endswith(SRC_FILE_EXT):
cc = Fore.GREEN
cr = Fore.RESET