OSDN Git Service

Fixed another assert exposed by fuzzing. The utility function getRegisterEnum()
authorJohnny Chen <johnny.chen@apple.com>
Wed, 14 Apr 2010 21:03:13 +0000 (21:03 +0000)
committerJohnny Chen <johnny.chen@apple.com>
Wed, 14 Apr 2010 21:03:13 +0000 (21:03 +0000)
commitd907d2566af966333cf170fae27b3e7847a855a4
tree07d5d409481b6eb88892318dc261f19ea1746a03
parentd394e272d22401297facddc004eb07f19b1a1422
Fixed another assert exposed by fuzzing.  The utility function getRegisterEnum()
was asserting because the (RegClass, RegNum) combination doesn't make sense from
an encoding point of view.

Since getRegisterEnum() is used all over the place, to change the code to check
for encoding error after each call would not only bloat the code, but also make
it less readable.  An Err flag is added to the ARMBasicMCBuilder where a client
can set a non-zero value to indicate some kind of error condition while building
up the MCInst.  ARMBasicMCBuilder::BuildIt() checks this flag and returns false
if a non-zero value is detected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101290 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/Disassembler/ARMDisassembler.cpp
lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
lib/Target/ARM/Disassembler/ARMDisassemblerCore.h
lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h