LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
char **OutMessages) {
raw_ostream *DebugOS = Action != LLVMReturnStatusAction ? &errs() : nullptr;
- string_ostream MsgsOS;
+ std::string Messages;
+ raw_string_ostream MsgsOS(Messages);
LLVMBool Result = verifyModule(*unwrap(M), OutMessages ? &MsgsOS : DebugOS);
report_fatal_error("Broken module found, compilation aborted!");
if (OutMessages)
- *OutMessages = strndup(MsgsOS.str().data(), MsgsOS.str().size());
+ *OutMessages = strdup(MsgsOS.str().c_str());
return Result;
}