[OpenMP][OMPT] Introduce a guard to handle OMPT return address

This is an alternative approach to address inconsistencies pointed out in: D90078
This patch makes sure that the return address is reset, when leaving the scope.
In some cases, I had to move the macro out of an if-statement to have it in the
right scope, in some cases I added an additional block to restrict the scope.

This patch does not handle inconsistencies, which might occur if the return
address is still set when we call into the application.

Test case (repeated_calls.c) provided by @hbae

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

GitOrigin-RevId: 6d3b81664a4b79b32ed2c2f46b21ab0dca9029cc
4 files changed