Skip to content

Commit 3efb3e7

Browse files
Googlercopybara-github
authored andcommitted
Replace a use of Abseil flat_hash_map with LLVM DenseMap
We are avoiding Abseil deps to make it easier to upstream, and the performance doesn't seem too different in some profiles I've checked. PiperOrigin-RevId: 896651951
1 parent 0e18cb3 commit 3efb3e7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

nullability/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ cc_library(
3636
deps = [
3737
":type_nullability",
3838
"@abseil-cpp//absl/base:nullability",
39-
"@abseil-cpp//absl/container:flat_hash_map",
4039
"@abseil-cpp//absl/log:check",
4140
"@llvm-project//clang:analysis",
4241
"@llvm-project//clang:ast",

nullability/pointer_nullability_lattice.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#include <ostream>
1010

1111
#include "absl/base/nullability.h"
12-
#include "absl/container/flat_hash_map.h"
1312
#include "nullability/type_nullability.h"
1413
#include "clang/AST/Expr.h"
1514
#include "clang/Analysis/FlowSensitive/ASTOps.h"
1615
#include "clang/Analysis/FlowSensitive/CachedConstAccessorsLattice.h"
1716
#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
17+
#include "llvm/ADT/DenseMap.h"
1818

1919
namespace clang::tidy::nullability {
2020
class PointerNullabilityLatticeBase {
@@ -23,12 +23,12 @@ class PointerNullabilityLatticeBase {
2323
// Nullability interpretation of types as set e.g. by per-file #pragmas.
2424
TypeNullabilityDefaults Defaults;
2525

26-
absl::flat_hash_map<const Expr *, TypeNullability> ExprToNullability;
26+
llvm::DenseMap<const Expr*, TypeNullability> ExprToNullability;
2727

2828
// Overridden symbolic nullability for pointer-typed decls.
2929
// These are set by PointerNullabilityAnalysis::assignNullabilityVariable,
3030
// and take precedence over the declared type.
31-
absl::flat_hash_map<const ValueDecl *absl_nonnull, PointerTypeNullability>
31+
llvm::DenseMap<const ValueDecl* absl_nonnull, PointerTypeNullability>
3232
DeclTopLevelNullability;
3333
};
3434

0 commit comments

Comments
 (0)