Switch lto codegen to using diagnostic handlers.
This patch removes the std::string& argument from a number of C++ LTO API calls
and instead makes them use the installed diagnostic handler. This would also
improve consistency of diagnostic handling infrastructure: if an LTO client used
lto_codegen_set_diagnostic_handler() to install a custom error handler, we do
not want some error messages to go through the custom error handler, and some
other error messages to go into sLastErrorString.
llvm-svn: 253367
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index 0839a56..ee389da 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -333,7 +333,7 @@
bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
maybeParseOptions(cg);
- return !unwrap(cg)->writeMergedModules(path, sLastErrorString);
+ return !unwrap(cg)->writeMergedModules(path);
}
const void *lto_codegen_compile(lto_code_gen_t cg, size_t *length) {
@@ -341,7 +341,7 @@
LibLTOCodeGenerator *CG = unwrap(cg);
CG->NativeObjectFile =
CG->compile(DisableVerify, DisableInline, DisableGVNLoadPRE,
- DisableLTOVectorization, sLastErrorString);
+ DisableLTOVectorization);
if (!CG->NativeObjectFile)
return nullptr;
*length = CG->NativeObjectFile->getBufferSize();
@@ -351,13 +351,13 @@
bool lto_codegen_optimize(lto_code_gen_t cg) {
maybeParseOptions(cg);
return !unwrap(cg)->optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
- DisableLTOVectorization, sLastErrorString);
+ DisableLTOVectorization);
}
const void *lto_codegen_compile_optimized(lto_code_gen_t cg, size_t *length) {
maybeParseOptions(cg);
LibLTOCodeGenerator *CG = unwrap(cg);
- CG->NativeObjectFile = CG->compileOptimized(sLastErrorString);
+ CG->NativeObjectFile = CG->compileOptimized();
if (!CG->NativeObjectFile)
return nullptr;
*length = CG->NativeObjectFile->getBufferSize();
@@ -368,7 +368,7 @@
maybeParseOptions(cg);
return !unwrap(cg)->compile_to_file(
name, DisableVerify, DisableInline, DisableGVNLoadPRE,
- DisableLTOVectorization, sLastErrorString);
+ DisableLTOVectorization);
}
void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) {