diff options
-rw-r--r-- | gcc/ipa-hello-world.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ipa-hello-world.c b/gcc/ipa-hello-world.c index b3f85d2e85c..e3ea729bbb9 100644 --- a/gcc/ipa-hello-world.c +++ b/gcc/ipa-hello-world.c @@ -224,6 +224,35 @@ compare_types_in_set(typeset &types) } } +static void +filter_out_types_in_set(typeset &types) +{ + // compare everything + if (!flag_tp_types_compared) return; + + const size_t buffer_size = 1024; + const size_t cli_length = strlen(flag_tp_comparison_functions); + gcc_assert(buffer_size > cli_length); + char whitelist[buffer_size]; + strcpy(whitelist, flag_tp_types_compared); + + bool name_allowed = false; + for (auto it = types.cbegin(); it != types.cend(); name_allowed ? ++it : it = types.erase(it)) + { + const_tree type = *it; + std::string observed_name = get_type_identifier(type); + char* saveptr = whitelist; + char* expected_name = NULL; + name_allowed = false; + + while (expected_name = strtok_r(saveptr, ",", &saveptr)) + { + name_allowed |= strcmp(expected_name, observed_name.c_str()) == 0; + } + } + +} + static unsigned int iphw_execute() { @@ -237,6 +266,7 @@ iphw_execute() collect_types_from_functions_with_gimple_body(node, types); } + filter_out_types_in_set(types); compare_types_in_set(types); return 0; } |