StdlibUnitest is the preferred system for testing that a certain piece
of code crashes. It's also the only way to get this test to pass when
run on an Android host device, since otherwise the device test runner
exits before confirming the output via FileCheck.
The runtime entry doesn't just report the error, unlike the other report* functions, it also does the crashing.
Reapplying independent of unrelated reverted patches.
The underlying problem is that e.g. even if a method is private but its class is public, the method can be referenced from another module - from the vtable of a derived class.
So far we handled this by setting the SILLinkage of such methods according to the visibility of the class. But this prevented dead method elimination.
Now I set the SILLinkage according to the visibility of the method. This enables dead method elimination, but it requires the following:
1) Still set the linkage in llvm so that it can be referenced from outside.
2) If the method is dead and eliminated, create a stub for it (which calls swift_reportMissingMethod).
Swift SVN r23889
If for some reason an eliminated dead method is called (e.g. because of a compiler bug),
then the application aborts with a readable error message.
Swift SVN r22990