[PATCH] D41451: Make DiagnosticIDs::getAllDiagnostics use std::vector
AndrĂ¡s Leitereg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 07:55:39 PST 2017
leanil created this revision.
leanil added reviewers: rsmith, xazax.hun.
Herald added a subscriber: rnkovacs.
The size of the result vector is currently around 4600 with Flavor::WarningOrError, which makes std::vector a better candidate than llvm::SmallVector.
https://reviews.llvm.org/D41451
Files:
include/clang/Basic/DiagnosticIDs.h
lib/Basic/Diagnostic.cpp
lib/Basic/DiagnosticIDs.cpp
Index: lib/Basic/DiagnosticIDs.cpp
===================================================================
--- lib/Basic/DiagnosticIDs.cpp
+++ lib/Basic/DiagnosticIDs.cpp
@@ -583,7 +583,7 @@
}
void DiagnosticIDs::getAllDiagnostics(diag::Flavor Flavor,
- SmallVectorImpl<diag::kind> &Diags) {
+ std::vector<diag::kind> &Diags) {
for (unsigned i = 0; i != StaticDiagInfoSize; ++i)
if (StaticDiagInfo[i].getFlavor() == Flavor)
Diags.push_back(StaticDiagInfo[i].DiagID);
Index: lib/Basic/Diagnostic.cpp
===================================================================
--- lib/Basic/Diagnostic.cpp
+++ lib/Basic/Diagnostic.cpp
@@ -363,7 +363,7 @@
diag::Severity Map,
SourceLocation Loc) {
// Get all the diagnostics.
- SmallVector<diag::kind, 64> AllDiags;
+ std::vector<diag::kind> AllDiags;
DiagnosticIDs::getAllDiagnostics(Flavor, AllDiags);
// Set the mapping.
Index: include/clang/Basic/DiagnosticIDs.h
===================================================================
--- include/clang/Basic/DiagnosticIDs.h
+++ include/clang/Basic/DiagnosticIDs.h
@@ -297,7 +297,7 @@
/// \brief Get the set of all diagnostic IDs.
static void getAllDiagnostics(diag::Flavor Flavor,
- SmallVectorImpl<diag::kind> &Diags);
+ std::vector<diag::kind> &Diags);
/// \brief Get the diagnostic option with the closest edit distance to the
/// given group name.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41451.127721.patch
Type: text/x-patch
Size: 1608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171220/25b4524b/attachment.bin>
More information about the cfe-commits
mailing list