From bea5ff94af31f64e6886fcb5e73e4ea59d321ccf Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 10 Dec 2020 00:08:29 -0500 Subject: [PATCH] fixup! [Make] remove BINARYBUILDER_LLVM_ASSERTS and use LLVM_ASSERTIONS instead This got corrupted in 7c0cb30f5bc3bc2e0c520bcc302f713c5738de9a, though we can also update to be a bit more explicit about our cantFail expectations and often avoid the issue. --- Make.inc | 4 ---- src/debuginfo.cpp | 5 ++--- src/jitlayers.cpp | 4 +--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Make.inc b/Make.inc index 0a763c90375929..41f104383402e4 100644 --- a/Make.inc +++ b/Make.inc @@ -450,10 +450,6 @@ CXX_DISABLE_ASSERTION := -DJL_NDEBUG DISABLE_ASSERTIONS := -DNDEBUG -DJL_NDEBUG endif -ifeq ($(LLVM_ASSERTIONS),0) -CXX_DISABLE_ASSERTION += -DNDEBUG -endif - # Compiler specific stuff ifeq ($(USEMSVC), 1) diff --git a/src/debuginfo.cpp b/src/debuginfo.cpp index 948701533cd036..43bd2d012ab7b3 100644 --- a/src/debuginfo.cpp +++ b/src/debuginfo.cpp @@ -973,10 +973,10 @@ static objfileentry_t &find_object_file(uint64_t fbase, StringRef fname) JL_NOTS DebugInfo(errorCodeToError(std::make_error_code(std::errc::no_such_file_or_directory))); // Can't find a way to construct an empty Expected object // that can be ignored. - ignoreError(DebugInfo); if (fname.substr(sep + 1) != info.filename) { debuginfopath = fname.substr(0, sep + 1).str(); debuginfopath += info.filename; + ignoreError(DebugInfo); DebugInfo = openDebugInfo(debuginfopath, info); } if (!DebugInfo) { @@ -994,9 +994,8 @@ static objfileentry_t &find_object_file(uint64_t fbase, StringRef fname) JL_NOTS DebugInfo = openDebugInfo(debuginfopath, info); } if (DebugInfo) { - errorobj = std::move(DebugInfo); + errorobj = cantFail(std::move(DebugInfo)); // Yes, we've checked, and yes LLVM want us to check again. - assert(errorobj); debugobj = errorobj->getBinary(); } else { diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index e52cd7b2d7a6ab..25ec013f98b900 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -488,9 +488,7 @@ void JuliaOJIT::DebugObjectRegistrar::registerObject(RTDyldObjHandleT H, const O continue; if (!(Flags & object::BasicSymbolRef::SF_Exported)) continue; - auto NameOrError = Symbol.getName(); - assert(NameOrError); - auto Name = NameOrError.get(); + auto Name = cantFail(Symbol.getName()); auto Sym = JIT.CompileLayer.findSymbolIn(H, Name.str(), true); assert(Sym); // note: calling getAddress here eagerly finalizes H