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)
commit27aacedf7d975243170206efb948a20d6fd4a2c1
tree5f1d4438753c0dddaee0857e509a8d810cd96267
parent2d4fd7e6b68753d975d2ed35ccb7ba2ad4483013
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174118 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/ARM/AsmParser/ARMAsmParser.cpp