[PATCH] D17920: Query the StringMap only once when creating MDString (NFC)

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 09:02:52 PDT 2016

joker.eph added a comment.

> std::unordered_map::emplace returns the classic <iterator, bool> pair. Perhaps emplace_second should do the same? Rather than relying on being able to detect the invalid default constructed state of the key?

I don't understand what you mean: `std::pair<iterator, bool> emplace_second(StringRef Key, ArgsTy &&... Args) `

Comment at: include/llvm/IR/Metadata.h:595
@@ -594,3 +594,3 @@
   MDString() : Metadata(MDStringKind, Uniqued), Entry(nullptr) {}
-  MDString(MDString &&) : Metadata(MDStringKind, Uniqued) {}
+  MDString(MDString &&R) = default;
dblaikie wrote:
> Why do we need a move ctor at all if we're supporting emplace? Can we just delete it? (even if we omit it, it should be removed implicitly - same with the move assignment above, I think)
StringMap requires movable types (for std::pair I think).


More information about the llvm-commits mailing list