By using std::shared_ptr for TreePatternNode, we can avoid leaking them.
Together with the other patches in linked to this one, ASAN shipped with
GCC8 is happy for TableGen.
I tried to keep the number of times we copy shared_ptrs around small,
but I probably missed a few places where there is no need to copy them.
Missing std::move:
should be: