[PATCH] D16106: [LTO] Fix error reporting when a file passed to libLTO is invalid or non-existent

Petr Pavlu via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 01:36:29 PST 2016


petpav01 added a comment.

Thank you for looking at this patch. I will update the patch to delete the `error()` call after `LTOModule::createFromFile()` from llvm-lto.


================
Comment at: tools/lto/lto.cpp:84
@@ -83,3 +83,2 @@
   }
-  sLastErrorString += '\n';
 }
----------------
rafael wrote:
> Is this related?
It is related because before r254721 function `lto_get_error_message()` would return "The file was not recognized as a valid object file" after calling `lto_module_create()` on an empty file. If only the `emitError()` calls are added then the returned error is "The file was not recognized as a valid object file\n" (i.e. it includes the newline character). This is problematic if someone had `printf("LTO error: %s\n", lto_get_error_message());` in their code as it will now print an empty line after the error.


http://reviews.llvm.org/D16106





More information about the llvm-commits mailing list