Teach the parser to deal with multiple spellings for the same
attribute, rather than requiring multiple cases in consumers of this
information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156666 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index 4177660..772fc2f 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -1062,7 +1062,8 @@
     Record &Attr = **I;
     
     bool SemaHandler = Attr.getValueAsBit("SemaHandler");
-    
+    bool DistinctSpellings = Attr.getValueAsBit("DistinctSpellings");
+
     if (SemaHandler) {
       std::vector<StringRef> Spellings =
         getValueAsListOfStrings(Attr, "Spellings");
@@ -1079,6 +1080,9 @@
           ProcessedAttrs.insert(AttrName);
 
         OS << "PARSED_ATTR(" << AttrName << ")\n";
+        
+        if (!DistinctSpellings)
+          break;
       }
     }
   }
@@ -1097,23 +1101,23 @@
     
     bool SemaHandler = Attr.getValueAsBit("SemaHandler");
     bool Ignored = Attr.getValueAsBit("Ignored");
-    
+    bool DistinctSpellings = Attr.getValueAsBit("DistinctSpellings");
     if (SemaHandler || Ignored) {
       std::vector<StringRef> Spellings =
         getValueAsListOfStrings(Attr, "Spellings");
 
       for (std::vector<StringRef>::const_iterator I = Spellings.begin(),
            E = Spellings.end(); I != E; ++I) {
-        StringRef AttrName = *I, Spelling = *I;
-       
-        AttrName = NormalizeAttrName(AttrName);
-        Spelling = NormalizeAttrSpelling(Spelling);
+        StringRef AttrName = NormalizeAttrName(DistinctSpellings
+                                                 ? *I
+                                                 : Spellings.front());
+        StringRef Spelling = NormalizeAttrSpelling(*I);
 
         if (SemaHandler)
           Matches.push_back(
-            StringMatcher::StringPair(Spelling,
-                                      std::string("return AttributeList::AT_") +
-                                      AttrName.str() + ";"));
+            StringMatcher::StringPair(
+              Spelling,
+              std::string("return AttributeList::AT_")+AttrName.str() + ";"));
         else
           Matches.push_back(
             StringMatcher::StringPair(