In C/C++, when an enumerator is defined, automatically generate a map of the symbolic names corresponding to the enum values.
For example, given the following enumerator:
enum Day {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
};
A table of string names, derived from the enum values, should be generated automatically, such as:
const char *__nameof_Day[] = {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
};
The above should be generated in Clang such that it is emitted as a compiler generated variable into the object file. As a result, searching through the symbols within the generated object file should show up the above symbol.
The same should work for enum class and enum struct (https://en.cppreference.com/w/cpp/language/enum) as well.
The variable name for the table of symbolic names should be derived from the original enum.
I tried creating a vector in enumdecl class and storing the names in it.