From 29d35ece8249f2d8a51437a5c008e6bf63da9874 Mon Sep 17 00:00:00 2001
From: Eric Li
Date: Mon, 25 Jul 2022 12:18:53 -0400
Subject: [clang][dataflow] Fix MapLattice::insert() to not drop return value
Fix `MapLattice` API to return `std::pair`,
allowing users to detect when an element has been inserted without
performing a redundant map lookup.
Differential Revision: https://reviews.llvm.org/D130497
---
clang/include/clang/Analysis/FlowSensitive/MapLattice.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'clang/include')
diff --git a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
index 014cd60..16b0c978 100644
--- a/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
+++ b/clang/include/clang/Analysis/FlowSensitive/MapLattice.h
@@ -54,10 +54,13 @@ public:
// The `bottom` element is the empty map.
static MapLattice bottom() { return MapLattice(); }
- void insert(const std::pair &P) { C.insert(P); }
+ std::pair
+ insert(const std::pair &P) {
+ return C.insert(P);
+ }
- void insert(std::pair &&P) {
- C.insert(std::move(P));
+ std::pair insert(std::pair &&P) {
+ return C.insert(std::move(P));
}
unsigned size() const { return C.size(); }
--
cgit v1.1