Refactor the RelocVisitor::visit method
authorRenato Golin <renato.golin@linaro.org>
Wed, 24 Sep 2014 20:07:22 +0000 (20:07 +0000)
committerRenato Golin <renato.golin@linaro.org>
Wed, 24 Sep 2014 20:07:22 +0000 (20:07 +0000)
commitc0104e4001c77a57208b031d23cc93de903b14d9
tree263ff20cd1b595e754c57b124d9b34509556ca84
parentf14380a2e835d823c7c44296cf55c2b73f877fbf
Refactor the RelocVisitor::visit method

This change replaces the brittle if/else chain of string comparisons
with a switch statement on the detected target triple, removing the
need for testing arbitrary architecture names returned from
getFileFormatName, whose primary purpose seems to be for display
(user-interface) purposes. The visitor now takes a reference to the
object file, rather than its arbitrary file format name to figure out
whether the file is a 32 or 64-bit object file and what the detected
target triple is.

A set of tests have been added to help show that the refactoring processes
relocations for the same targets as the original code.

Patch by Charlie Turner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218406 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Object/ELFObjectFile.h
include/llvm/Object/RelocVisitor.h
lib/DebugInfo/DWARFContext.cpp
test/DebugInfo/processes-relocations.ll [new file with mode: 0644]