Now I use clang build my .c file to .s file. And I have used the llvm API modify the IR. However, now I can't save my modified IR to a file. I want to use "LLVMWriteBitcodeToFile", but I can't find the struct of "LLVMOpaqueModule"; I want to use "WriteBitcodeToFile", it always show me "type mismatch". And I also want to know how to build an IR file to a executable file.
Next are two methods I use to save a module:
1、First use WriteBitcodeToFile
bool unbuffered = false;
llvm::raw_ostream ro(unbuffered);
WriteBitcodeToFile(m, ro);
2、Second use LLVMWriteBitcodeToFile
const char *Path = "hello2.s";
int ans = LLVMWriteBitcodeToFile(m, Path);
note: m is a point of Module instance