From 1ab3e7930af1ac581b0e7b84c0648e2df472efc0 Mon Sep 17 00:00:00 2001 From: Venkateshwar Reddy Kandula Date: Mon, 9 Sep 2024 01:08:59 +0000 Subject: [PATCH] SWDEV-480556:new HIP APIs with struct defined inside union. - Fixes issue where types defined inside of a union were unable to find by function which generates hip_begin.cpp.i. - Also works for futureHIP APIs with nunion, when defined new types inside it. Change-Id: If1e1c4f80dc511450fd154d64d39a05f81565220 [ROCm/rocprofiler commit: 52125f7966bb9bb0278131d300e52aa651cb3d81] --- projects/rocprofiler/plugin/ctf/gen_api_files.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/rocprofiler/plugin/ctf/gen_api_files.py b/projects/rocprofiler/plugin/ctf/gen_api_files.py index 9683b41c82..096c0b4ec8 100644 --- a/projects/rocprofiler/plugin/ctf/gen_api_files.py +++ b/projects/rocprofiler/plugin/ctf/gen_api_files.py @@ -656,6 +656,19 @@ def _process_file(api_prefix, path): # Get return value information dictionary. retval_info = _get_retval_info(path) + # add support for structures defined inside union. + new_items = [] + for struct_name, struct in cpp_header.classes.items(): + # Check if the struct_name starts with 'union '. + if re.match(r'^union \w+', struct_name) is not None: + parts = struct_name.split('::') + simplified = parts[-1] + if simplified != "union ": + new_items.append((simplified, cpp_header.classes.get(struct_name))) + + for key, value in new_items: + cpp_header.classes[key] = value + # Find callback data structure. for struct_name, struct in cpp_header.classes.items(): if re.match(r'^' + api_prefix + r'_api_data\w+$', struct_name) is not None: