[PATCH] D24152: Support the overloadable attribute with _Generic expressions

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 07:44:48 PDT 2016


dblaikie added inline comments.

================
Comment at: lib/Sema/SemaOverload.cpp:12996
@@ +12995,3 @@
+      // selection expression.
+      std::vector<Expr *> AssocExprs(GSE->getAssocExprs().vec());
+      unsigned ResultIdx = GSE->getResultIndex();
----------------
george.burgess.iv wrote:
> Is there a reason this isn't a `SmallVector` instead?
Another note on this - we should generally prefer copy init over direct init (less power, less responsibility/easier to read):

  std::vector<Expr*> AssocExprs = GSE->getAssocExprs().vec();

(& as for George's question: since ArrayRef::vec returns std::vector, it's cheaper to store in a std::vector (by move) than to make a copy into a SmallVector)


https://reviews.llvm.org/D24152





More information about the cfe-commits mailing list