[ARM] clang-format ARM sources

llvm-svn: 234474
This commit is contained in:
Denis Protivensky 2015-04-09 10:17:22 +00:00
parent 6b3a33ff00
commit 455e44b0e4
5 changed files with 21 additions and 26 deletions

View File

@ -24,9 +24,7 @@ public:
ARMELFMappingAtom(T&&... args)
: ELFDefinedAtom<ELFT>(std::forward<T>(args)...) {}
DefinedAtom::CodeModel codeModel() const override {
return Model;
}
DefinedAtom::CodeModel codeModel() const override { return Model; }
};
template <class ELFT> class ARMELFDefinedAtom : public ELFDefinedAtom<ELFT> {
@ -36,9 +34,9 @@ public:
: ELFDefinedAtom<ELFT>(std::forward<T>(args)...) {}
bool isThumbFunc() const {
const auto* symbol = this->_symbol;
const auto *symbol = this->_symbol;
return symbol->getType() == llvm::ELF::STT_FUNC &&
(static_cast<uint64_t>(symbol->st_value) & 0x1);
(static_cast<uint64_t>(symbol->st_value) & 0x1);
}
/// Correct st_value for symbols addressing Thumb instructions
@ -63,9 +61,8 @@ public:
protected:
/// Returns initial addend; for ARM it is 0, because it is read
/// during the relocations applying
Reference::Addend getInitialAddend(ArrayRef<uint8_t>,
uint64_t,
const Elf_Rel&) const override {
Reference::Addend getInitialAddend(ArrayRef<uint8_t>, uint64_t,
const Elf_Rel &) const override {
return 0;
}

View File

@ -76,7 +76,7 @@ void ARMExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
template <class ELFT>
unique_bump_ptr<SymbolTable<ELFT>>
ARMExecutableWriter<ELFT>::createSymbolTable() {
ARMExecutableWriter<ELFT>::createSymbolTable() {
return unique_bump_ptr<SymbolTable<ELFT>>(
new (this->_alloc) ARMSymbolTable<ELFT>(this->_ctx));
}
@ -110,11 +110,11 @@ std::error_code ARMExecutableWriter<ELFT>::setELFHeader() {
llvm::report_fatal_error(
"Two least bits must be zero for ARM entry point");
}
break;
break;
case DefinedAtom::codeARMThumb:
// Fixup entry point for Thumb code.
this->_elfHeader->e_entry(al->_virtualAddr | 0x1);
break;
break;
default:
llvm_unreachable("Wrong code model of entry point atom");
}

View File

@ -164,7 +164,7 @@ static void relocR_ARM_REL32(uint8_t *location, uint64_t P, uint64_t S,
/// \brief R_ARM_PREL31 - ((S + A) | T) - P
static void relocR_ARM_PREL31(uint8_t *location, uint64_t P, uint64_t S,
int64_t A, bool addressesThumb) {
int64_t A, bool addressesThumb) {
uint64_t T = addressesThumb;
uint32_t result = (uint32_t)(((S + A) | T) - P);
const uint32_t mask = 0x7FFFFFFF;
@ -250,7 +250,7 @@ static void relocR_ARM_THM_JUMP11(uint8_t *location, uint64_t P, uint64_t S,
llvm::dbgs() << " P: 0x" << Twine::utohexstr(P);
llvm::dbgs() << " result: 0x" << Twine::utohexstr(result) << "\n");
//we cut off first bit because it is always 1 according to p. 4.5.3
// we cut off first bit because it is always 1 according to p. 4.5.3
result = (result & 0x0FFE) >> 1;
applyThumb16Reloc(location, result, 0x7FF);

View File

@ -19,8 +19,7 @@ typedef llvm::object::ELFType<llvm::support::little, 2, false> ARMELFType;
template <class ELFT> class ARMTargetLayout;
class ARMTargetRelocationHandler final
: public TargetRelocationHandler {
class ARMTargetRelocationHandler final : public TargetRelocationHandler {
public:
ARMTargetRelocationHandler(ARMTargetLayout<ARMELFType> &layout)
: _armLayout(layout) {}

View File

@ -97,9 +97,7 @@ public:
StringRef customSectionName() const override { return _section; }
ContentType contentType() const override {
return DefinedAtom::typeCode;
}
ContentType contentType() const override { return DefinedAtom::typeCode; }
uint64_t size() const override { return rawContent().size(); }
@ -206,8 +204,7 @@ public:
/// Serves as a mapping symbol in the release mode.
class ARMPLTAtom : public PLTAtom {
public:
ARMPLTAtom(const File &f, const std::string &name)
: PLTAtom(f, ".plt") {
ARMPLTAtom(const File &f, const std::string &name) : PLTAtom(f, ".plt") {
#ifndef NDEBUG
_name = name;
#else
@ -375,8 +372,8 @@ protected:
std::error_code handleTLSIE32(const Reference &ref) {
if (const auto *target = dyn_cast<DefinedAtom>(ref.target())) {
const_cast<Reference &>(ref).setTarget(
static_cast<Derived *>(this)->getTLSTPOFF32(target));
const_cast<Reference &>(ref)
.setTarget(static_cast<Derived *>(this)->getTLSTPOFF32(target));
return std::error_code();
}
llvm_unreachable("R_ARM_TLS_IE32 reloc targets wrong atom type");
@ -499,8 +496,8 @@ protected:
std::error_code handleIFUNC(const DefinedAtom &atom, const Reference &ref) {
auto target = dyn_cast<const DefinedAtom>(ref.target());
if (target && target->contentType() == DefinedAtom::typeResolver) {
const_cast<Reference &>(ref).setTarget(
getIFUNCPLTEntry(target, isThumbCode(atom.codeModel())));
const_cast<Reference &>(ref)
.setTarget(getIFUNCPLTEntry(target, isThumbCode(atom.codeModel())));
}
return std::error_code();
}
@ -672,7 +669,8 @@ public:
name += da->name();
name += "_from_arm";
// Create parts of veneer with mapping symbols.
auto v_a = new (_file._alloc) Veneer_ARM_B_BL_Static_a_Atom(_file, secName, name);
auto v_a =
new (_file._alloc) Veneer_ARM_B_BL_Static_a_Atom(_file, secName, name);
addVeneerWithMapping<DefinedAtom::codeARM_a>(da, v_a, name);
auto v_d = new (_file._alloc) Veneer_ARM_B_BL_Static_d_Atom(_file, secName);
addVeneerWithMapping<DefinedAtom::codeARM_d>(v_a, v_d, name);
@ -695,7 +693,8 @@ public:
name += da->name();
name += "_from_thumb";
// Create parts of veneer with mapping symbols.
auto v_t = new (_file._alloc) Veneer_THM_B_BL_Static_t_Atom(_file, secName, name);
auto v_t =
new (_file._alloc) Veneer_THM_B_BL_Static_t_Atom(_file, secName, name);
addVeneerWithMapping<DefinedAtom::codeARM_t>(da, v_t, name);
auto v_a = new (_file._alloc) Veneer_THM_B_BL_Static_a_Atom(_file, secName);
addVeneerWithMapping<DefinedAtom::codeARM_a>(v_t, v_a, name);