// Executes CodeGenAction and returns the pointer (caller should own and delete it) // Returns NULL on failure (in case of any compiler errors etc.) clang::CodeGenAction* emitLLVM(const char* szSourceCodeFilePath) { // create the compiler instance setup for this file as the main file prepareCompilerforFile(szSourceCodeFilePath); // Create an action and make the compiler instance carry it out clang::CodeGenAction *Act = new clang::EmitLLVMOnlyAction(); if (!m_CompilerInstance.ExecuteAction(*Act)) return NULL; return Act; }