r231803 - 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.

Aaron Ballman aaron at aaronballman.com
Tue Mar 10 10:19:25 PDT 2015


Author: aaronballman
Date: Tue Mar 10 12:19:18 2015
New Revision: 231803

URL: http://llvm.org/viewvc/llvm-project?rev=231803&view=rev
Log:
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.

Modified:
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=231803&r1=231802&r2=231803&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Mar 10 12:19:18 2015
@@ -1297,7 +1297,11 @@ CreateSemanticSpellings(const std::vecto
     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;





More information about the cfe-commits mailing list