[MC] Simplify the logic of applying fixup for fragments, NFCI
authorShengchen Kan <shengchen.kan@intel.com>
Thu, 9 Jul 2020 07:06:27 +0000 (15:06 +0800)
committerShengchen Kan <shengchen.kan@intel.com>
Thu, 9 Jul 2020 08:39:13 +0000 (16:39 +0800)
commite59e39b7c4092ead733d25e7801429fd9dab7007
tree2766bf2839be92e8a8ae42e1e954976e6ffacbcb
parenta60c31fd6229d2b2e578fa7e192e98303e69223c
[MC] Simplify the logic of applying fixup for fragments, NFCI

Replace mutiple `if else`  clauses with a `switch` clause and remove redundant checks. Before this patch, we need to add a statement like `if(!isa<MCxxxFragment>(Frag)) `  here each time we add a new kind of `MCEncodedFragment` even if it has no fixups. After this patch, we don't need to do that.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D83366
llvm/lib/MC/MCAssembler.cpp