Factor out common pattern in Exp_Ch6
This commit refactors the Exp_Ch6 module in the Ada compiler to extract a common code pattern, improving code maintainability.
This commit refactors the Ada compiler’s Exp_Ch6 module by extracting a common prologue used in procedures dealing with build-in-place calls. The change introduces a new function, Get_Function_Entity, and replaces the duplicated prologue code with calls to this function. This improves code readability and maintainability without introducing any functional changes.
In Details
This commit targets the Exp_Ch6 module, specifically the procedures Make_Build_In_Place_Call_In_Allocator, Make_Build_In_Place_Call_In_Anonymous_Context, Make_Build_In_Place_Call_In_Assignment, and Make_Build_In_Place_Call_In_Object_Declaration. It extracts the common prologue into the new Get_Function_Entity function. Search context: Ada compiler Exp_Ch6 build-in-place Get_Function_Entity.
For Context
Compilers are often organized into modules that handle specific tasks. This commit refactors a module in the Ada compiler responsible for handling "build-in-place" calls (allocating memory directly where it will be used). By extracting a common code sequence into a separate function, the code becomes more organized and easier to maintain. Search context: Ada compiler Exp_Ch6 build-in-place Get_Function_Entity.