[PATCH] D48100: Append new attributes to the end of an AttributeList.

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 12 15:39:39 PDT 2018


Meinersbur added inline comments.


================
Comment at: lib/Sema/SemaOverload.cpp:6194
 static SmallVector<EnableIfAttr *, 4>
 getOrderedEnableIfAttrs(const FunctionDecl *Function) {
   SmallVector<EnableIfAttr *, 4> Result;
----------------
nicholas wrote:
> This function shouldn't be necessary any more. All it's doing now is making an unnecessary copy.
I tried to keep the diff small and obvious. I'll refactor it in the next diff update.


================
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);
----------------
nicholas wrote:
> 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.
Thanks for the hint.


Repository:
  rC Clang

https://reviews.llvm.org/D48100





More information about the cfe-commits mailing list