[Lldb-commits] [lldb] edc869c - [lldb-vscode] Use a DenseMap to pacify overly aggressive linters
Benjamin Kramer via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 22 04:09:35 PDT 2021
Author: Benjamin Kramer
Date: 2021-04-22T13:07:39+02:00
New Revision: edc869cb57fb4cf999c8a388b48ae4ecd027bfe7
URL: https://github.com/llvm/llvm-project/commit/edc869cb57fb4cf999c8a388b48ae4ecd027bfe7
DIFF: https://github.com/llvm/llvm-project/commit/edc869cb57fb4cf999c8a388b48ae4ecd027bfe7.diff
LOG: [lldb-vscode] Use a DenseMap to pacify overly aggressive linters
Some linters get rather upset upon seeing
`std::unordered_map<const char*`, because it looks like a map of
strings but isn't. lldb uses interned strings so this is not a problem.
DenseMap is a better data structure for this anyways, so use that
instead.
Added:
Modified:
lldb/tools/lldb-vscode/lldb-vscode.cpp
Removed:
################################################################################
diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 5f9e96bf6f50..4ceca3806f4f 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -41,10 +41,10 @@
#include <set>
#include <sstream>
#include <thread>
-#include <unordered_map>
#include <vector>
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
@@ -2931,7 +2931,7 @@ void request_variables(const llvm::json::Object &request) {
const int64_t end_idx = start_idx + ((count == 0) ? num_children : count);
// We first find out which variable names are duplicated
- std::unordered_map<const char *, int> variable_name_counts;
+ llvm::DenseMap<const char *, int> variable_name_counts;
for (auto i = start_idx; i < end_idx; ++i) {
lldb::SBValue variable = g_vsc.variables.GetValueAtIndex(i);
if (!variable.IsValid())
More information about the lldb-commits
mailing list