[clang] [clang-tools-extra] [Attributes][HLSL] Teach EnumArgument to refer to an external enum (PR #70835)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 31 10:37:12 PDT 2023
================
@@ -1010,14 +1022,17 @@ namespace {
// trivial because some enumeration values have multiple named
// enumerators, such as type_visibility(internal) and
// type_visibility(hidden) both mapping to TypeVisibilityAttr::Hidden.
- OS << "const char *" << getAttrName() << "Attr::Convert" << type
- << "ToStr(" << type << " Val) {\n"
+ OS << "const char *" << getAttrName() << "Attr::Convert" << shortType
+ << "ToStr(" << fullType << " Val) {\n"
<< " switch(Val) {\n";
SmallDenseSet<StringRef, 8> Uniques;
for (size_t I = 0; I < enums.size(); ++I) {
if (Uniques.insert(enums[I]).second)
- OS << " case " << getAttrName() << "Attr::" << enums[I]
- << ": return \"" << values[I] << "\";\n";
+ OS << " case " << fullType << "::" << enums[I] << ": return \""
+ << values[I] << "\";\n";
+ }
+ if (isExternal) {
+ OS << " default: llvm_unreachable(\"Invalid attribute value\");\n";
----------------
erichkeane wrote:
Could you please provide an excerpt from of `Attr.inc` for me that shows what the external looks like here? I'm having a bit of a hassle figuring out what allt he changes you've made are doing.
https://github.com/llvm/llvm-project/pull/70835
More information about the cfe-commits
mailing list