Fix names of enums and their elements

Use the containing class name as prefix, and add the name of the enum
itself to the prefix for the scoped enums, instead of doing something
strange and semi-random that we did before, with prefixes including the
namespace (which should never be the case without "nspace" feature), but
not the scoped enum.

This also fixes renaming of enum elements, as a side effect, which
didn't work before, add run test for enum_rename unit test to prove it.
This commit is contained in:
Vadim Zeitlin 2021-11-04 17:15:16 +01:00
commit f4ee8e5369
3 changed files with 55 additions and 9 deletions

View file

@ -0,0 +1,12 @@
#include <assert.h>
#include "enum_rename/enum_rename_wrap.h"
int main() {
assert(M_Jan == 0);
assert(May == 1);
assert(M_Dec == 2);
assert(S_Can == 1);
assert(S_Must == 2);
}

View file

@ -6,7 +6,7 @@
int main() {
assert(GlobalInstance == globalinstance1);
assert(Char == 'a');
assert(iFoo_Char == 'a');
bar2(1);
bar3(1);
bar1(1);