[PATCH] D84048: DR2303: Prefer 'nearer' base classes during template deduction.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 22 18:47:21 PDT 2020
rsmith added inline comments.
================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1281
+ "Base class that isn't a record?");
+ ToVisit.push_back(Base.getType()->getAs<RecordType>());
+ }
----------------
erichkeane wrote:
> rsmith wrote:
> > It would be better to add the class to `Visited` here rather than in the loop below -- that is, only add each class to `ToVisit` once rather than only processing each class once. That would put a tighter upper bound on the size of `ToVisit`.
> I'm perhaps missing something here... Can you clarify your suggestion a bit more? If we add it to 'Visited' here, it will never get visited in the while-loop below, right?
The idea would be to remove the `Visited` check in the loops below. We would guarantee that each class is only visited once by only adding it to `ToVisit` once. (As an example, we do the same thing for `Queue` and `Visited` here: https://github.com/llvm/llvm-project/blob/master/clang/lib/Sema/SemaLookup.cpp#L1992)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84048/new/
https://reviews.llvm.org/D84048
More information about the cfe-commits
mailing list