Author: Richard Smith Date: 2020-01-31T13:40:32-08:00 New Revision: de876adab0cb43b79ffc7c5e66cc9053accbb074
URL: https://github.com/llvm/llvm-project/commit/de876adab0cb43b79ffc7c5e66cc9053accbb074 DIFF: https://github.com/llvm/llvm-project/commit/de876adab0cb43b79ffc7c5e66cc9053accbb074.diff LOG: [diagtree] Use a different color for unimplemented GCC diagnostic flags instead of the "enabled by default" color. It may be technically correct to list unimplemented diagnostics as "enabled by default" but it's quite misleading. Added: Modified: clang/tools/diagtool/DiagnosticNames.h clang/tools/diagtool/TreeView.cpp Removed: ################################################################################ diff --git a/clang/tools/diagtool/DiagnosticNames.h b/clang/tools/diagtool/DiagnosticNames.h index d8fd6401ef6b..f541e88577cc 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 96951287cc4e..843bd377e574 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"; } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits