From: Gabor Horvath Date: Wed, 20 Dec 2017 16:55:41 +0000 (+0000) Subject: Make DiagnosticIDs::getAllDiagnostics use std::vector. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d32ec8fb0d04f322b2ad1ddfaec72110d9a3a96;p=clang Make DiagnosticIDs::getAllDiagnostics use std::vector. NFC. The size of the result vector is currently around 4600 with Flavor::WarningOrError, which makes std::vector a better candidate than llvm::SmallVector. Patch by: Andras Leitereg! Differential Revision: https://reviews.llvm.org/D39372 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321190 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index 43183a120b..b4ea85ba85 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -297,7 +297,7 @@ public: /// \brief Get the set of all diagnostic IDs. static void getAllDiagnostics(diag::Flavor Flavor, - SmallVectorImpl &Diags); + std::vector &Diags); /// \brief Get the diagnostic option with the closest edit distance to the /// given group name. diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 640b42c1ca..26baa838f8 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -363,7 +363,7 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc) { // Get all the diagnostics. - SmallVector AllDiags; + std::vector AllDiags; DiagnosticIDs::getAllDiagnostics(Flavor, AllDiags); // Set the mapping. diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 5c53f35aa6..c4c425d9eb 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -583,7 +583,7 @@ DiagnosticIDs::getDiagnosticsInGroup(diag::Flavor Flavor, StringRef Group, } void DiagnosticIDs::getAllDiagnostics(diag::Flavor Flavor, - SmallVectorImpl &Diags) { + std::vector &Diags) { for (unsigned i = 0; i != StaticDiagInfoSize; ++i) if (StaticDiagInfo[i].getFlavor() == Flavor) Diags.push_back(StaticDiagInfo[i].DiagID);