diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-19 16:14:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-19 16:14:14 +0000 |
commit | adafc2edc0dc4fa25ea6f0a136f599a6ac279081 (patch) | |
tree | 4a3d07ea81207f6910da6aef8bcc1e8440130a01 /include/clang/Serialization/ContinuousRangeMap.h | |
parent | ecb19382e1041f4e90f44c541173b85e4f328b84 (diff) |
The submodule offset map can introduce "empty" remapping entries for
imported modules that don't introduce any new entities of a particular
kind. Allow these entries to be replaced with entries for another
loaded module.
In the included test case, selectors exhibit this behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization/ContinuousRangeMap.h')
-rw-r--r-- | include/clang/Serialization/ContinuousRangeMap.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/clang/Serialization/ContinuousRangeMap.h b/include/clang/Serialization/ContinuousRangeMap.h index 7f78320410..f368a80a97 100644 --- a/include/clang/Serialization/ContinuousRangeMap.h +++ b/include/clang/Serialization/ContinuousRangeMap.h @@ -68,6 +68,16 @@ public: "Must insert keys in order."); Rep.push_back(Val); } + + void insertOrReplace(const value_type &Val) { + iterator I = std::lower_bound(Rep.begin(), Rep.end(), Val, Compare()); + if (I != Rep.end() && I->first == Val.first) { + I->second = Val.second; + return; + } + + Rep.insert(I, Val); + } typedef typename Representation::iterator iterator; typedef typename Representation::const_iterator const_iterator; |