-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[DenseMap] Fix MSVC buildbot failure in lookup_or #142268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-adt Author: Ramkumar Ramachandra (artagnon) Changes4bf67cd ([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. Full diff: https://github.com/llvm/llvm-project/pull/142268.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index de41a212c65ab..62a33500e3ad2 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -226,6 +226,12 @@ class DenseMapBase : public DebugEpochBase {
return Default;
}
+ ValueT lookup_or(const_arg_type_t<KeyT> Val, const ValueT &Default) const {
+ if (const BucketT *Bucket = doFind(Val))
+ return Bucket->getSecond();
+ return Default;
+ }
+
/// at - Return the entry for the specified key, or abort if no such
/// entry exists.
const ValueT &at(const_arg_type_t<KeyT> Val) const {
|
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.
089fad5
to
5fdd3bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for updating the patch!
4bf67cd ([DenseMap] Fix constness issues with lookup_or) introduced a buildbot failure: https://lab.llvm.org/buildbot/#/builders/63/builds/6559 The patch deviates from the spec and MSVC complains, where it doesn't bind an lvalue to an rvalue reference. Fix it by qualifying the argument of lookup_or with remove_cv_t. Proof: https://godbolt.org/z/sjTvGMbce
4bf67cd ([DenseMap] Fix constness issues with lookup_or) introduced a buildbot failure: https://lab.llvm.org/buildbot/#/builders/63/builds/6559 The patch deviates from the spec and MSVC complains, where it doesn't bind an lvalue to an rvalue reference. Fix it by qualifying the argument of lookup_or with remove_cv_t. Proof: https://godbolt.org/z/sjTvGMbce
4bf67cd ([DenseMap] Fix constness issues with lookup_or) introduced a buildbot failure:
https://lab.llvm.org/buildbot/#/builders/63/builds/6559
The patch deviates from the spec and MSVC complains, where it doesn't bind an lvalue to an rvalue reference. Fix it by qualifying the argument of lookup_or with remove_cv_t.
Proof: https://godbolt.org/z/sjTvGMbce