Do use sym:name for the enum names themselves
Ever sincefb4d70027(Represent enums as themselves in generated code, 2016-04-14) the code used "name" attribute for the enums themselves instead of "sym:name". The reason for this was documented in the comment added inf4ee8e536(Fix names of enums and their elements, 2021-11-04), but this explanation was only half-correct: although we indeed shouldn't use sym:name for typedefs, we should use it for the enums themselves, as otherwise renaming them didn't work and enums were generated in the wrappers with the wrong names. Fix this by using sym:name for non typedef'd enums.
This commit is contained in:
parent
6fb95e7e97
commit
1c06a43e35
1 changed files with 9 additions and 6 deletions
|
|
@ -2465,12 +2465,15 @@ public:
|
|||
scoped_dohptr cxx_enumname;
|
||||
|
||||
// Unnamed enums may just have no name at all or have a synthesized invalid name of the form "$unnamedN$ which is indicated by "unnamed" attribute.
|
||||
//
|
||||
// Also note that we use "name" here and not "sym:name" because the latter is the name of typedef if there is one, while we want to use the name of enum
|
||||
// itself here and, even more importantly, use the enum, and not the typedef, name as prefix for its elements.
|
||||
if (String* const name = Getattr(n, "unnamed") ? NIL : Getattr(n, "name")) {
|
||||
// But the name may included the containing class, so get rid of it.
|
||||
enumname = Swig_scopename_last(name);
|
||||
if (String* const name = Getattr(n, "unnamed") ? NULL : Getattr(n, "sym:name")) {
|
||||
// If it's a typedef, its sym:name is the typedef name, but we don't want to use it here (we already use it for the typedef we generate), so use the
|
||||
// actual C++ name instead.
|
||||
if (tdname) {
|
||||
// But the name may include the containing class, so get rid of it.
|
||||
enumname = Swig_scopename_last(Getattr(n, "name"));
|
||||
} else {
|
||||
enumname = Copy(name);
|
||||
}
|
||||
|
||||
// C++ enum name shouldn't include the prefix, so make a copy before enumname is modified below.
|
||||
if (cxx_enum_decl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue