aboutsummaryrefslogtreecommitdiff
path: root/clang/include
diff options
context:
space:
mode:
authorEric Li <li.zhe.hua@gmail.com>2022-07-25 12:18:53 -0400
committerEric Li <li.zhe.hua@gmail.com>2022-07-25 14:24:33 -0400
commit29d35ece8249f2d8a51437a5c008e6bf63da9874 (patch)
tree0a88f142de088446bf101dfd4856ed8a595326ad /clang/include
parentfb95b8dc350ea84cf51b5f65aaaf1a5146ff3e47 (diff)
downloadllvm-29d35ece8249f2d8a51437a5c008e6bf63da9874.zip
llvm-29d35ece8249f2d8a51437a5c008e6bf63da9874.tar.gz
llvm-29d35ece8249f2d8a51437a5c008e6bf63da9874.tar.bz2
[clang][dataflow] Fix MapLattice::insert() to not drop return value
Fix `MapLattice` API to return `std::pair<iterator, bool>`, allowing users to detect when an element has been inserted without performing a redundant map lookup. Differential Revision: https://reviews.llvm.org/D130497
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Analysis/FlowSensitive/MapLattice.h9
1 files changed, 6 insertions, 3 deletions
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<const key_type, mapped_type> &P) { C.insert(P); }
+ std::pair<iterator, bool>
+ insert(const std::pair<const key_type, mapped_type> &P) {
+ return C.insert(P);
+ }
- void insert(std::pair<const key_type, mapped_type> &&P) {
- C.insert(std::move(P));
+ std::pair<iterator, bool> insert(std::pair<const key_type, mapped_type> &&P) {
+ return C.insert(std::move(P));
}
unsigned size() const { return C.size(); }