Original commit message: " Move the test compiler setup in a common place. NFCI This patch reduces the copy paste in the unittest/CodeGen folder by moving the common compiler setup phase in a header file. Differential revision: https://reviews.llvm.org/D91061 " This patch includes a fix for the memory leaks pointed out by @vitalybuka