diff --git a/clang/tools/diagtool/DiagnosticNames.h b/clang/tools/diagtool/DiagnosticNames.h index d8fd6401ef6b8..f541e88577cc5 100644 --- a/clang/tools/diagtool/DiagnosticNames.h +++ b/clang/tools/diagtool/DiagnosticNames.h @@ -76,11 +76,11 @@ namespace diagtool { return *this; } - bool operator==(group_iterator &Other) const { + bool operator==(const group_iterator &Other) const { return CurrentID == Other.CurrentID; } - bool operator!=(group_iterator &Other) const { + bool operator!=(const group_iterator &Other) const { return CurrentID != Other.CurrentID; } }; diff --git a/clang/tools/diagtool/TreeView.cpp b/clang/tools/diagtool/TreeView.cpp index 96951287cc4e8..843bd377e574c 100644 --- a/clang/tools/diagtool/TreeView.cpp +++ b/clang/tools/diagtool/TreeView.cpp @@ -36,6 +36,17 @@ class TreePrinter { return Diags.isIgnored(DiagID, SourceLocation()); } + static bool unimplemented(const GroupRecord &Group) { + if (!Group.diagnostics().empty()) + return false; + + for (const GroupRecord &GR : Group.subgroups()) + if (!unimplemented(GR)) + return false; + + return true; + } + static bool enabledByDefault(const GroupRecord &Group) { for (const DiagnosticRecord &DR : Group.diagnostics()) { if (isIgnored(DR.DiagID)) @@ -53,7 +64,9 @@ class TreePrinter { void printGroup(const GroupRecord &Group, unsigned Indent = 0) { out.indent(Indent * 2); - if (enabledByDefault(Group)) + if (unimplemented(Group)) + out << Colors::RED; + else if (enabledByDefault(Group)) out << Colors::GREEN; else out << Colors::YELLOW; @@ -117,7 +130,9 @@ class TreePrinter { void showKey() { out << '\n' << Colors::GREEN << "GREEN" << Colors::RESET - << " = enabled by default\n\n"; + << " = enabled by default"; + out << '\n' << Colors::RED << "RED" << Colors::RESET + << " = unimplemented (accepted for GCC compatibility)\n\n"; } };