C#: Move implicit entry definitions inside method bodies in SSA construction
Methods with multiple implementations such as
// File1.cs
class MultiImpl
{
public int M(int x) => x;
}
// File2.cs
class MultiImpl
{
public int M(int x) => x;
}
give rise to a single CFG, where flow splits immediately following the special entry node:
flowchart TD
1["enter M"]
2["exit M"]
3["exit M (normal)"]
4["access to parameter x"]
5["access to parameter x"]
1 --> 4
3 --> 2
4 --> 3
5 --> 3
1 --> 5
Before this PR, implicit entry SSA definitions (such as for parameters) were placed at the enter M node, meaning that all implementation bodies would share those definitions. However, in https://github.com/github/codeql/pull/16817 we would like to be able to differentiate between the method bodies, and this PR consequently moves the implicit entry definitions into the basic blocks that start each method body (i.e., the access to parameter x nodes above).
Note that single-bodied methods (which is the far most common case) will still have the implicit entry SSA definitions at the entry nodes, since the basic block for the method body entry is the same as the basic block for the special entry node.