From 0e37afa15ea127909573a8f65dad72f30f70f2f0 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 25 May 2011 05:05:01 +0000 Subject: A StringRef-ication of the DiagnosticIDs API and internals. Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static diagnostic data structures, which resulted in a huge global-var-init function. Depends on llvm commit r132046. llvm-svn: 132047 --- clang/lib/Driver/Driver.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/Driver/Driver.cpp') diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index fe650547f19..9ebf850c3a3 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -398,9 +398,10 @@ void Driver::PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const { /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories /// option. static void PrintDiagnosticCategories(llvm::raw_ostream &OS) { - for (unsigned i = 1; // Skip the empty category. - const char *CategoryName = DiagnosticIDs::getCategoryNameFromID(i); ++i) - OS << i << ',' << CategoryName << '\n'; + // Skip the empty category. + for (unsigned i = 1, max = DiagnosticIDs::getNumberOfCategories(); + i != max; ++i) + OS << i << ',' << DiagnosticIDs::getCategoryNameFromID(i) << '\n'; } bool Driver::HandleImmediateArgs(const Compilation &C) { -- cgit v1.2.3