diff options
author | Craig Topper <craig.topper@gmail.com> | 2013-08-29 06:06:18 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2013-08-29 06:06:18 +0000 |
commit | 46c8fca7b32a7613f9b37b46c381dd064b773b30 (patch) | |
tree | 7c62966e01353d1c4ae5b70a8cd360863f3457cd | |
parent | 354f20a8720732aa1745d1ff9595382cee324ee2 (diff) |
Make getDiagnosticsInGroup helper method a static function in the cpp file and move the WarningOption struct into an anonymous namespace instead of clang namespace since it no longer needs to be forward declared in the header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189569 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticIDs.h | 7 | ||||
-rw-r--r-- | lib/Basic/DiagnosticIDs.cpp | 31 |
2 files changed, 16 insertions, 22 deletions
diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index 25e5dfd0e8..237b826f98 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -22,7 +22,6 @@ namespace clang { class DiagnosticsEngine; class SourceLocation; - struct WarningOption; // Import the diagnostic enums themselves. namespace diag { @@ -240,12 +239,6 @@ public: static StringRef getNearestWarningOption(StringRef Group); private: - /// \brief Get the set of all diagnostic IDs in the given group. - /// - /// \param[out] Diags - On return, the diagnostics in the group. - void getDiagnosticsInGroup(const WarningOption *Group, - SmallVectorImpl<diag::kind> &Diags) const; - /// \brief Classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticClient. /// diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 71752bb38f..de3d469cad 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -505,17 +505,19 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, #include "clang/Basic/DiagnosticGroups.inc" #undef GET_DIAG_ARRAYS -struct clang::WarningOption { - uint16_t NameOffset; - uint16_t Members; - uint16_t SubGroups; - - // String is stored with a pascal-style length byte. - StringRef getName() const { - return StringRef(DiagGroupNames + NameOffset + 1, - DiagGroupNames[NameOffset]); - } -}; +namespace { + struct WarningOption { + uint16_t NameOffset; + uint16_t Members; + uint16_t SubGroups; + + // String is stored with a pascal-style length byte. + StringRef getName() const { + return StringRef(DiagGroupNames + NameOffset + 1, + DiagGroupNames[NameOffset]); + } + }; +} // Second the table of options, sorted by name for fast binary lookup. static const WarningOption OptionTable[] = { @@ -538,9 +540,8 @@ StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) { return StringRef(); } -void DiagnosticIDs::getDiagnosticsInGroup( - const WarningOption *Group, - SmallVectorImpl<diag::kind> &Diags) const { +static void getDiagnosticsInGroup(const WarningOption *Group, + SmallVectorImpl<diag::kind> &Diags) { // Add the members of the option diagnostic set. const int16_t *Member = DiagArrays + Group->Members; for (; *Member != -1; ++Member) @@ -562,7 +563,7 @@ bool DiagnosticIDs::getDiagnosticsInGroup( Found->getName() != Group) return true; // Option not found. - getDiagnosticsInGroup(Found, Diags); + ::getDiagnosticsInGroup(Found, Diags); return false; } |