Start the support for AVX instructions with 256-bit %ymm registers. A couple of
[oota-llvm.git] / utils / TableGen / ClangDiagnosticsEmitter.cpp
index d0e813bc2733c7d8ba2261f2dd12cac2fe1631f4..75b6252c4f9f70961d40bbab9b4c3033c903ff0e 100644 (file)
@@ -70,15 +70,16 @@ getCategoryFromDiagGroup(const Record *Group,
 /// lives in.
 static std::string getDiagnosticCategory(const Record *R,
                                          DiagGroupParentMap &DiagGroupParents) {
-  // If the diagnostic itself has a category, get it.
-  std::string CatName = R->getValueAsString("CategoryName");
-  if (!CatName.empty()) return CatName;
-  
-  DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"));
-  if (Group == 0) return "";
+  // If the diagnostic is in a group, and that group has a category, use it.
+  if (DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"))) {
+    // Check the diagnostic's diag group for a category.
+    std::string CatName = getCategoryFromDiagGroup(Group->getDef(),
+                                                   DiagGroupParents);
+    if (!CatName.empty()) return CatName;
+  }
   
-  // Check the diagnostic's diag group for a category.
-  return getCategoryFromDiagGroup(Group->getDef(), DiagGroupParents);
+  // If the diagnostic itself has a category, get it.
+  return R->getValueAsString("CategoryName");
 }
 
 namespace {
@@ -239,7 +240,7 @@ void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
     
     const std::vector<std::string> &SubGroups = I->second.SubGroups;
     if (!SubGroups.empty()) {
-      OS << "static const char DiagSubGroup" << I->second.IDNo << "[] = { ";
+      OS << "static const short DiagSubGroup" << I->second.IDNo << "[] = { ";
       for (unsigned i = 0, e = SubGroups.size(); i != e; ++i) {
         std::map<std::string, GroupInfo>::iterator RI =
           DiagsInGroup.find(SubGroups[i]);