[llvm-branch-commits] [llvm-branch] r104597 - /llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp

Daniel Dunbar daniel at zuster.org
Tue May 25 07:07:25 PDT 2010


Author: ddunbar
Date: Tue May 25 09:07:25 2010
New Revision: 104597

URL: http://llvm.org/viewvc/llvm-project?rev=104597&view=rev
Log:
diaggroup categories should take precedence over diag-specific groups.

Modified:
    llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp

Modified: llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=104597&r1=104596&r2=104597&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ llvm/branches/Apple/whitney/utils/TableGen/ClangDiagnosticsEmitter.cpp Tue May 25 09:07:25 2010
@@ -70,15 +70,16 @@
 /// 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 {





More information about the llvm-branch-commits mailing list