Switch the code added in r173885 to use the new, shiny RTTI
authorChandler Carruth <chandlerc@gmail.com>
Thu, 31 Jan 2013 23:43:14 +0000 (23:43 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 31 Jan 2013 23:43:14 +0000 (23:43 +0000)
commite5d8d0d64b6cc85e8aaa750cb68e90e672937517
tree07a9f8f418033210e00c5b65e1a25583c97d57cc
parenta983b4de7af0e6ccd31194fa445234e1e399171f
Switch the code added in r173885 to use the new, shiny RTTI
infrastructure on MCStreamer to test for whether there is an
MCELFStreamer object available.

This is just a cleanup on the AsmPrinter side of things, moving ad-hoc
tests of random APIs to a direct type query. But the AsmParser
completely broken. There were no tests, it just blindly cast its
streamer to an MCELFStreamer and started manipulating it.

I don't have a test case -- this actually failed on LLVM's own
regression test suite. Unfortunately the failure only appears when the
stars, compilers, and runtime align to misbehave when we read a pointer
to a formatted_raw_ostream as-if it were an MCAssembler. =/

UBSan would catch this immediately.

Many thanks to Matt for doing about 80% of the debugging work here in
GDB, Jim for helping to explain how exactly to fix this, and others for
putting up with the hair pulling that ensued during debugging it.

llvm-svn: 174118
llvm/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp