LTOModule::isBitcodeFile() shouldn't assert when returning false.
authorNico Weber <nicolasweber@gmx.de>
Tue, 31 Oct 2017 16:39:47 +0000 (16:39 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 31 Oct 2017 16:39:47 +0000 (16:39 +0000)
commit05c988473f508a1c37ab739898ed95b5456c47cf
treefef61bd62f8979b3a734b70f576483b9b2cd8ba4
parentc212cc88e2b61d197d9a60acbc116c52d3555101
LTOModule::isBitcodeFile() shouldn't assert when returning false.

Fixes a bunch of assert-on-invalid-bitcode regressions after 315483.
Expected<> calls assertIsChecked() in its dtor, and operator bool() only calls
setChecked() if there's no error. So for functions that don't return an error
itself, the Expected<> version needs explicit code to disarm the error that the
ErrorOr<> code didn't need.

https://reviews.llvm.org/D39437

llvm-svn: 317010
llvm/lib/LTO/LTOModule.cpp
llvm/test/tools/lto/no-bitcode.s [new file with mode: 0644]