We currently don't have any tests for remangler error handling, because in
asserts builds it asserts. This patch adds a flag that only exists in !NDEBUG
builds to turn off assertions when inside the unit tests.
We need this in order to gather relevant information when this situation
arises; it's clearly happening (e.g. rdar://86071019), but not often
enough for it to trigger in a build with assertions enabled.
rdar://89139049
These were originally meant to be no-return functions since they're going to abort. They were accidentally changed to no-discard functions despite not having a return value.
The internal compiler headers should not include swift shim headers. Removing this dependency allows libSwift to import Swift compiler headers (otherwise, we get name conflics, because we import SwiftShims headers twice: from the source includes and build includes).
Defining DEMANGLE_ASSERT as assert() is simple but messes up the file/line
information from assert(). Make a dedicated assertion failure function and use
that instead to fix.
Also enable some tests that were disabled because they triggered abort()
calls in the remanglers.
rdar://79725187
Because DEMANGLER_ASSERT() might cause the remanglers to return a ManglingError
with the code ManglingError::AssertionFailed, it's useful to have a line number
in the ManglingError as well as the other information. This is also potentially
helpful for other cases where the code is used multiple times in the remanglers.
rdar://79725187