GCOVProfiling: Avoid use-after-move
authorDavid Blaikie <dblaikie@gmail.com>
Sun, 13 Sep 2020 19:54:36 +0000 (12:54 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 13 Sep 2020 19:54:36 +0000 (12:54 -0700)
commit6e06f1cd0816b03d9336083667a0c71760d6b99f
tree7295b38d58d972151e1d4331f6d74dbdf523a5f6
parent8889faaed0b7c8545b67b040c380b983264ebc67
GCOVProfiling: Avoid use-after-move

Turns out this was use-after-move of function_ref, which is trivially
copyable and movable, so the move did nothing and use after move was
safe.

But since this function_ref is being copied into a std::function, change
the function_ref to be std::function to avoid extra layers of type
erasure indirection - and then it's a real use after move, and fix that
by referring to the moved-to member variable rather than the moved-from
parameter.
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp