This patch creates the OmpRewriteMutator pass that runs at the end of RewriteParseTree(). This pass is intended to make OpenMP-specific mutations to the PFT after name resolution.
In the case of the atomic_default_mem_order clause of the REQUIRES directive, name resolution results in populating global symbols with information about the REQUIRES clauses that apply to that scope. The new rewrite pass is then able to use this information in order to explicitly set the memory order of ATOMIC constructs for which that is not already specified.
Given that this rewrite happens before semantics checks, the check of the order in which ATOMIC constructs without explicit memory order and REQUIRES directives with atomic_default_mem_order appear is moved earlier into the rewrite pass. Otherwise, these problems would not be caught by semantics checks, since the PFT would be modified by that stage.
This is patch 4/5 of a series splitting D149337 to simplify review.
Depends on D157983.
Is this class of use currently?