[LLVMdev] StringMap question

Valery Pushkar pollnossa at gmail.com
Sat Jul 11 05:41:20 PDT 2015


Hello everyone!

I'm a newcomer for the great LLVM project. I've started to explore the
source code of LLVM project to become more familiar with it, and I've found
some strange usage of move semantics in constructor of StringMapImpl(
StringMapImpl &&RHS) {...} class in include/llvm/ADT/StringMap.h line 56.
Could anyone explain me the purpose of zeroing of all fields of RHS in the
body of this constructor if the declaration of the constructor uses move
semantics? Here is the consturctor code below:

*StringMapImpl(StringMapImpl &&RHS)*
*      : TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets),*
*        NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones),*
*        ItemSize(RHS.ItemSize) {*
*    RHS.TheTable = nullptr;*
*    RHS.NumBuckets = 0;*
*    RHS.NumItems = 0;*
*    RHS.NumTombstones = 0;*
*  }*

Thank you very much!

BR,
Valeriy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150711/a6ad0882/attachment.html>


More information about the llvm-dev mailing list