Skip to content

Commit 089fad5

Browse files
committed
[DenseMap] Work around a MSVC bug in lookup_or
4bf67cd ([DenseMap] Fix constness issues with lookup_or) introduced a buildbot failure: https://lab.llvm.org/buildbot/#/builders/63/builds/6559 This seems to be a bug in MSVC, where it doesn't bind an lvalue to an rvalue reference. Work around it by introducing a const-lvalue-reference variant of lookup_or.
1 parent 6f7268e commit 089fad5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ class DenseMapBase : public DebugEpochBase {
226226
return Default;
227227
}
228228

229+
ValueT lookup_or(const_arg_type_t<KeyT> Val, const ValueT &Default) const {
230+
if (const BucketT *Bucket = doFind(Val))
231+
return Bucket->getSecond();
232+
return Default;
233+
}
234+
229235
/// at - Return the entry for the specified key, or abort if no such
230236
/// entry exists.
231237
const ValueT &at(const_arg_type_t<KeyT> Val) const {

0 commit comments

Comments
 (0)