[libomptarget] PR38704: Fix erase of ShadowPtrMap

erase() invalidates the iterator and returns a new one pointing
to the following element. The code now follows the example at
https://en.cppreference.com/w/cpp/container/map/erase.
(The added testcase crashes without this patch.)

Reported by David Binderman (https://llvm.org/PR38704)!

Differential Revision: https://reviews.llvm.org/D51623

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@341371 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed