IDLGenerators: Allow initialize() as an IDL member name

While not a C++ keyword, we already define a `Foo::initialize()` method
on every generated binding type, so we need to avoid clashing with that.
This commit is contained in:
Sam Atkins 2025-04-23 12:04:09 +01:00
commit 3ca879776f
Notes: github-actions[bot] 2025-07-21 09:07:01 +00:00

View file

@ -324,7 +324,20 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface)
static ByteString make_input_acceptable_cpp(ByteString const& input)
{
if (input.is_one_of("class", "template", "for", "default", "char", "namespace", "delete", "inline", "register", "switch", "mutable", "continue")) {
if (input.is_one_of(
"char",
"class",
"continue",
"default",
"delete",
"for",
"initialize",
"inline",
"mutable",
"namespace",
"register",
"switch",
"template")) {
StringBuilder builder;
builder.append(input);
builder.append('_');