summaryrefslogtreecommitdiffstats
path: root/clang/tools/diagtool/ListWarnings.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-06-01 22:23:02 +0000
committerJordan Rose <jordan_rose@apple.com>2012-06-01 22:23:02 +0000
commit573649eb8bc39647e54e8940b0475e9191fc188c (patch)
treecaf64fcfa9593dab5afa7508c1c1092c2790b4a7 /clang/tools/diagtool/ListWarnings.cpp
parent74516bafae87ccc4b70c987ea010febc331b8ac2 (diff)
downloadbcm5719-llvm-573649eb8bc39647e54e8940b0475e9191fc188c.tar.gz
bcm5719-llvm-573649eb8bc39647e54e8940b0475e9191fc188c.zip
[diagtool] Pull show-enabled back out for now.
Need to figure out how to get Frontend's warning parsing without bringing in all of Frontend. llvm-svn: 157847
Diffstat (limited to 'clang/tools/diagtool/ListWarnings.cpp')
-rw-r--r--clang/tools/diagtool/ListWarnings.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/clang/tools/diagtool/ListWarnings.cpp b/clang/tools/diagtool/ListWarnings.cpp
index 6c59338eef1..2bbeca80249 100644
--- a/clang/tools/diagtool/ListWarnings.cpp
+++ b/clang/tools/diagtool/ListWarnings.cpp
@@ -13,7 +13,6 @@
//===----------------------------------------------------------------------===//
#include "DiagTool.h"
-#include "DiagnosticNames.h"
#include "clang/Basic/Diagnostic.h"
#include "llvm/Support/Format.h"
#include "llvm/ADT/StringMap.h"
@@ -27,6 +26,28 @@ DEF_DIAGTOOL("list-warnings",
using namespace clang;
namespace {
+struct StaticDiagNameIndexRec {
+ const char *NameStr;
+ unsigned short DiagID;
+ uint8_t NameLen;
+
+ StringRef getName() const {
+ return StringRef(NameStr, NameLen);
+ }
+};
+}
+
+static const StaticDiagNameIndexRec StaticDiagNameIndex[] = {
+#define DIAG_NAME_INDEX(ENUM) { #ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t) },
+#include "clang/Basic/DiagnosticIndexName.inc"
+#undef DIAG_NAME_INDEX
+ { 0, 0, 0 }
+};
+
+static const unsigned StaticDiagNameIndexSize =
+ sizeof(StaticDiagNameIndex)/sizeof(StaticDiagNameIndex[0])-1;
+
+namespace {
struct Entry {
llvm::StringRef DiagName;
llvm::StringRef Flag;
@@ -52,8 +73,8 @@ int ListWarnings::run(unsigned int argc, char **argv, llvm::raw_ostream &out) {
std::vector<Entry> Flagged, Unflagged;
llvm::StringMap<std::vector<unsigned> > flagHistogram;
- for (const diagtool::DiagnosticRecord *di = diagtool::BuiltinDiagnostics,
- *de = di + diagtool::BuiltinDiagnosticsCount; di != de; ++di) {
+ for (const StaticDiagNameIndexRec *di = StaticDiagNameIndex, *de = StaticDiagNameIndex + StaticDiagNameIndexSize;
+ di != de; ++di) {
unsigned diagID = di->DiagID;
OpenPOWER on IntegriCloud