[PATCH] D48100: Append new attributes to the end of an AttributeList.
Nick Lewycky via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 12 15:33:12 PDT 2018
nicholas added inline comments.
================
Comment at: lib/Sema/SemaOverload.cpp:6194
static SmallVector<EnableIfAttr *, 4>
getOrderedEnableIfAttrs(const FunctionDecl *Function) {
SmallVector<EnableIfAttr *, 4> Result;
----------------
This function shouldn't be necessary any more. All it's doing now is making an unnecessary copy.
================
Comment at: lib/Sema/SemaOverload.cpp:8943
- // FIXME: The next several lines are just
- // specific_attr_iterator<EnableIfAttr> but going in declaration order,
- // instead of reverse order which is how they're stored in the AST.
auto Cand1Attrs = getOrderedEnableIfAttrs(Cand1);
auto Cand2Attrs = getOrderedEnableIfAttrs(Cand2);
----------------
This would become "auto Cand1Attrs = Cand1->specific_attrs<EnableIfAttr>();" but I think you can simplify that even further if you want. To do that you'd need to sink the "return Comparison::Worse;" inside the loop that follows it. If you don't do that you'll have to switch the calls to Cand1Attrs.size() and Cand2Attrs.size() into calls to std::distance, since llvm::iterator_range doesn't have a size() method.
Repository:
rC Clang
https://reviews.llvm.org/D48100
More information about the cfe-commits
mailing list