From: Aaron Ballman Date: Tue, 10 Mar 2015 17:19:18 +0000 (+0000) Subject: The semantic spelling enumeration should retain values to the spelling list indexes... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91f2b9ec1e248203f32ab08735837145a9a19417;p=clang The semantic spelling enumeration should retain values to the spelling list indexes used by the attribute. The only attribute affected by this in practice is the OpenCLImageAccessAttr, which has duplicate semantic spellings that are automatically stripped. We do not implicitly create an OpenCLImageAccessAttr, so this change only affects out of tree users. There is no way to test this behavior specifically that I can see, since this only affects implicit creation of attributes. Fixes PR22403. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231803 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 6369c342ce..16b38a37ca 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -1297,7 +1297,11 @@ CreateSemanticSpellings(const std::vector &Spellings, Uniques.insert(EnumName); if (I != Spellings.begin()) Ret += ",\n"; - Ret += " " + EnumName; + // Duplicate spellings are not considered part of the semantic spelling + // enumeration, but the spelling index and semantic spelling values are + // meant to be equivalent, so we must specify a concrete value for each + // enumerator. + Ret += " " + EnumName + " = " + llvm::utostr(Idx); } Ret += "\n };\n\n"; return Ret;