[lld] r247323 - Fix Clang-tidy misc-use-override warnings, other minor fixes.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 11:51:36 PDT 2015
Author: ruiu
Date: Thu Sep 10 13:51:36 2015
New Revision: 247323
URL: http://llvm.org/viewvc/llvm-project?rev=247323&view=rev
Log:
Fix Clang-tidy misc-use-override warnings, other minor fixes.
Patch from Eugene Zelenko!
Modified:
lld/trunk/include/lld/Core/Parallel.h
lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
lld/trunk/lib/Core/Error.cpp
lld/trunk/lib/ReaderWriter/ELF/Atoms.h
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
lld/trunk/lib/ReaderWriter/ELF/Writer.h
lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
lld/trunk/lib/ReaderWriter/MachO/Atoms.h
lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
Modified: lld/trunk/include/lld/Core/Parallel.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Parallel.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Parallel.h (original)
+++ lld/trunk/include/lld/Core/Parallel.h Thu Sep 10 13:51:36 2015
@@ -104,7 +104,7 @@ namespace internal {
/// \brief An abstract class that takes closures and runs them asynchronously.
class Executor {
public:
- virtual ~Executor() {}
+ virtual ~Executor() = default;
virtual void add(std::function<void()> func) = 0;
};
@@ -166,7 +166,7 @@ public:
}).detach();
}
- ~ThreadPoolExecutor() {
+ ~ThreadPoolExecutor() override {
std::unique_lock<std::mutex> lock(_mutex);
_stop = true;
lock.unlock();
@@ -330,4 +330,4 @@ void parallel_for_each(Iterator begin, I
#endif
} // end namespace lld
-#endif
+#endif // LLD_CORE_PARALLEL_H
Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Thu Sep 10 13:51:36 2015
@@ -32,7 +32,7 @@ class MachOFile;
class MachOLinkingContext : public LinkingContext {
public:
MachOLinkingContext();
- ~MachOLinkingContext();
+ ~MachOLinkingContext() override;
enum Arch {
arch_unknown,
@@ -373,4 +373,4 @@ private:
} // end namespace lld
-#endif
+#endif // LLD_READER_WRITER_MACHO_LINKING_CONTEXT_H
Modified: lld/trunk/lib/Core/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Error.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/Core/Error.cpp (original)
+++ lld/trunk/lib/Core/Error.cpp Thu Sep 10 13:51:36 2015
@@ -75,7 +75,6 @@ const std::error_category &lld::LinkerSc
return o;
}
-
namespace lld {
/// Temporary class to enable make_dynamic_error_code() until
@@ -83,7 +82,7 @@ namespace lld {
/// other than error_code.
class dynamic_error_category : public std::error_category {
public:
- ~dynamic_error_category() LLVM_NOEXCEPT {}
+ ~dynamic_error_category() override = default;
const char *name() const LLVM_NOEXCEPT override {
return "lld.dynamic_error";
@@ -125,4 +124,4 @@ std::error_code make_dynamic_error_code(
return std::error_code(categorySingleton.add(msg.str()), categorySingleton);
}
-}
+} // namespace lld
Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Atoms.h Thu Sep 10 13:51:36 2015
@@ -140,7 +140,7 @@ public:
_referenceList(referenceList), _contentType(typeUnknown),
_permissions(permUnknown) {}
- ~ELFDefinedAtom() {}
+ ~ELFDefinedAtom() override = default;
const ELFFile<ELFT> &file() const override { return _owningFile; }
StringRef name() const override { return _symbolName; }
@@ -490,4 +490,4 @@ public:
} // end namespace elf
} // end namespace lld
-#endif
+#endif // LLD_READER_WRITER_ELF_ATOMS_H
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Thu Sep 10 13:51:36 2015
@@ -165,7 +165,7 @@ public:
/// \brief Set the virtual address of each Atom in the Section. This
/// routine gets called after the linker fixes up the virtual address
/// of the section
- virtual void assignVirtualAddress(uint64_t addr) override;
+ void assignVirtualAddress(uint64_t addr) override;
/// \brief Set the file offset of each Atom in the section. This routine
/// gets called after the linker fixes up the section offset
@@ -534,7 +534,7 @@ public:
StringRef interp);
void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
- llvm::FileOutputBuffer &buffer);
+ llvm::FileOutputBuffer &buffer) override;
private:
StringRef _interp;
@@ -613,4 +613,4 @@ private:
} // end namespace elf
} // end namespace lld
-#endif
+#endif // LLD_READER_WRITER_ELF_SECTION_CHUNKS_H
Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Thu Sep 10 13:51:36 2015
@@ -135,7 +135,7 @@ public:
// Write the Segment
void write(ELFWriter *writer, TargetLayout<ELFT> &layout,
- llvm::FileOutputBuffer &buffer);
+ llvm::FileOutputBuffer &buffer) override;
int64_t flags() const;
@@ -149,7 +149,7 @@ public:
/// Finalize the segment, before we want to write the segment header
/// information
- void finalize();
+ void finalize() override;
// For LLVM RTTI
static bool classof(const Chunk<ELFT> *c) {
@@ -168,7 +168,7 @@ public:
/// If the content corresponds to Code, this will return Segment::Code
/// If the content corresponds to Data, this will return Segment::Data
/// If the content corresponds to TLS, this will return Segment::TLS
- virtual int getContentType() const;
+ int getContentType() const override;
int pageSize() const { return this->_ctx.getPageSize(); }
int rawflags() const { return _atomflags; }
@@ -237,10 +237,10 @@ public:
/// Finalize the segment, before we want to write the segment header
/// information
- void finalize();
+ void finalize() override;
};
} // end namespace elf
} // end namespace lld
-#endif
+#endif // LLD_READER_WRITER_ELF_SEGMENT_CHUNKS_H
Modified: lld/trunk/lib/ReaderWriter/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Writer.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Writer.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Writer.h Thu Sep 10 13:51:36 2015
@@ -24,7 +24,7 @@ public:
virtual void buildChunks(const File &file) = 0;
/// \brief Writes the chunks into the output file specified by path
- virtual std::error_code writeFile(const File &file, StringRef path) = 0;
+ std::error_code writeFile(const File &file, StringRef path) override = 0;
/// \brief Get the virtual address of \p atom after layout.
virtual uint64_t addressOfAtom(const Atom *atom) = 0;
@@ -32,4 +32,4 @@ public:
} // end namespace elf
} // end namespace lld
-#endif
+#endif // LLD_READER_WRITER_ELF_WRITER_H
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm.cpp Thu Sep 10 13:51:36 2015
@@ -28,8 +28,8 @@ using llvm::support::little32_t;
class ArchHandler_arm : public ArchHandler {
public:
- ArchHandler_arm();
- virtual ~ArchHandler_arm();
+ ArchHandler_arm() = default;
+ ~ArchHandler_arm() override = default;
const Registry::KindStrings *kindStrings() override { return _sKindStrings; }
@@ -202,10 +202,6 @@ private:
// ArchHandler_arm
//===----------------------------------------------------------------------===//
-ArchHandler_arm::ArchHandler_arm() { }
-
-ArchHandler_arm::~ArchHandler_arm() { }
-
const Registry::KindStrings ArchHandler_arm::_sKindStrings[] = {
LLD_KIND_STRING_ENTRY(invalid),
LLD_KIND_STRING_ENTRY(modeThumbCode),
@@ -463,7 +459,6 @@ bool ArchHandler_arm::isArmMovt(uint32_t
return (instruction & 0x0FF00000) == 0x03400000;
}
-
uint16_t ArchHandler_arm::getWordFromThumbMov(uint32_t instruction) {
assert(isThumbMovw(instruction) || isThumbMovt(instruction));
uint32_t i = ((instruction & 0x00000400) >> 10);
@@ -480,7 +475,6 @@ uint16_t ArchHandler_arm::getWordFromArm
return (imm4 << 12) | imm12;
}
-
uint32_t ArchHandler_arm::setWordFromThumbMov(uint32_t instr, uint16_t word) {
assert(isThumbMovw(instr) || isThumbMovt(instr));
uint32_t imm4 = (word & 0xF000) >> 12;
@@ -497,7 +491,6 @@ uint32_t ArchHandler_arm::setWordFromArm
return (instr & 0xFFF0F000) | (imm4 << 16) | imm12;
}
-
uint32_t ArchHandler_arm::clearThumbBit(uint32_t value, const Atom *target) {
// The assembler often adds one to the address of a thumb function.
// We need to undo that so it does not look like an addend.
@@ -1040,7 +1033,6 @@ void ArchHandler_arm::generateAtomConten
}
}
-
bool ArchHandler_arm::useExternalRelocationTo(const Atom &target) {
// Undefined symbols are referenced via external relocations.
if (isa<UndefinedAtom>(&target))
@@ -1409,7 +1401,6 @@ bool ArchHandler_arm::isThumbFunction(co
return false;
}
-
class Thumb2ToArmShimAtom : public SimpleDefinedAtom {
public:
Thumb2ToArmShimAtom(MachOFile &file, StringRef targetName,
@@ -1455,7 +1446,6 @@ private:
StringRef _name;
};
-
class ArmToThumbShimAtom : public SimpleDefinedAtom {
public:
ArmToThumbShimAtom(MachOFile &file, StringRef targetName,
@@ -1510,7 +1500,6 @@ const DefinedAtom *ArchHandler_arm::crea
return new (file.allocator()) ArmToThumbShimAtom(file, targetName, target);
}
-
std::unique_ptr<mach_o::ArchHandler> ArchHandler::create_arm() {
return std::unique_ptr<mach_o::ArchHandler>(new ArchHandler_arm());
}
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp Thu Sep 10 13:51:36 2015
@@ -31,8 +31,8 @@ using llvm::support::little64_t;
class ArchHandler_arm64 : public ArchHandler {
public:
- ArchHandler_arm64();
- virtual ~ArchHandler_arm64();
+ ArchHandler_arm64() = default;
+ ~ArchHandler_arm64() override = default;
const Registry::KindStrings *kindStrings() override { return _sKindStrings; }
@@ -213,10 +213,6 @@ private:
static uint32_t setImm12(uint32_t instr, uint32_t offset);
};
-ArchHandler_arm64::ArchHandler_arm64() {}
-
-ArchHandler_arm64::~ArchHandler_arm64() {}
-
const Registry::KindStrings ArchHandler_arm64::_sKindStrings[] = {
LLD_KIND_STRING_ENTRY(invalid),
LLD_KIND_STRING_ENTRY(branch26),
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86.cpp Thu Sep 10 13:51:36 2015
@@ -30,8 +30,8 @@ using llvm::support::little32_t;
class ArchHandler_x86 : public ArchHandler {
public:
- ArchHandler_x86();
- virtual ~ArchHandler_x86();
+ ArchHandler_x86() = default;
+ ~ArchHandler_x86() override = default;
const Registry::KindStrings *kindStrings() override { return _sKindStrings; }
@@ -49,9 +49,11 @@ public:
bool needsCompactUnwind() override {
return false;
}
+
Reference::KindValue imageOffsetKind() override {
return invalid;
}
+
Reference::KindValue imageOffsetKindIndirect() override {
return invalid;
}
@@ -68,7 +70,6 @@ public:
return invalid;
}
-
uint32_t dwarfCompactUnwindType() override {
return 0x04000000U;
}
@@ -169,10 +170,6 @@ private:
// ArchHandler_x86
//===----------------------------------------------------------------------===//
-ArchHandler_x86::ArchHandler_x86() {}
-
-ArchHandler_x86::~ArchHandler_x86() { }
-
const Registry::KindStrings ArchHandler_x86::_sKindStrings[] = {
LLD_KIND_STRING_ENTRY(invalid),
LLD_KIND_STRING_ENTRY(modeCode),
@@ -545,7 +542,6 @@ bool ArchHandler_x86::useExternalRelocat
return false;
}
-
void ArchHandler_x86::appendSectionRelocations(
const DefinedAtom &atom,
uint64_t atomSectionOffset,
@@ -633,7 +629,6 @@ void ArchHandler_x86::appendSectionReloc
}
}
-
std::unique_ptr<mach_o::ArchHandler> ArchHandler::create_x86() {
return std::unique_ptr<mach_o::ArchHandler>(new ArchHandler_x86());
}
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp Thu Sep 10 13:51:36 2015
@@ -30,8 +30,8 @@ using llvm::support::little64_t;
class ArchHandler_x86_64 : public ArchHandler {
public:
- ArchHandler_x86_64();
- virtual ~ArchHandler_x86_64();
+ ArchHandler_x86_64() = default;
+ ~ArchHandler_x86_64() override = default;
const Registry::KindStrings *kindStrings() override { return _sKindStrings; }
@@ -95,9 +95,11 @@ public:
bool needsCompactUnwind() override {
return true;
}
+
Reference::KindValue imageOffsetKind() override {
return imageOffset;
}
+
Reference::KindValue imageOffsetKindIndirect() override {
return imageOffsetGot;
}
@@ -228,11 +230,6 @@ private:
uint64_t inAtomAddress);
};
-
-ArchHandler_x86_64::ArchHandler_x86_64() { }
-
-ArchHandler_x86_64::~ArchHandler_x86_64() { }
-
const Registry::KindStrings ArchHandler_x86_64::_sKindStrings[] = {
LLD_KIND_STRING_ENTRY(invalid), LLD_KIND_STRING_ENTRY(branch32),
LLD_KIND_STRING_ENTRY(ripRel32), LLD_KIND_STRING_ENTRY(ripRel32Minus1),
@@ -600,7 +597,6 @@ void ArchHandler_x86_64::applyFixupFinal
llvm_unreachable("invalid x86_64 Reference Kind");
}
-
void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref,
uint8_t *loc,
uint64_t fixupAddress,
@@ -800,7 +796,6 @@ void ArchHandler_x86_64::appendSectionRe
llvm_unreachable("unknown x86_64 Reference Kind");
}
-
std::unique_ptr<mach_o::ArchHandler> ArchHandler::create_x86_64() {
return std::unique_ptr<mach_o::ArchHandler>(new ArchHandler_x86_64());
}
Modified: lld/trunk/lib/ReaderWriter/MachO/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/Atoms.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/Atoms.h Thu Sep 10 13:51:36 2015
@@ -103,7 +103,6 @@ private:
StringRef _sectionName;
};
-
class MachOTentativeDefAtom : public SimpleDefinedAtom {
public:
MachOTentativeDefAtom(const File &f, const StringRef name, Scope scope,
@@ -138,7 +137,7 @@ public:
StringRef dylibInstallName, bool weakDef)
: SharedLibraryAtom(), _file(file), _name(name),
_dylibInstallName(dylibInstallName) {}
- virtual ~MachOSharedLibraryAtom() {}
+ ~MachOSharedLibraryAtom() override = default;
StringRef loadName() const override { return _dylibInstallName; }
@@ -168,8 +167,7 @@ private:
StringRef _dylibInstallName;
};
+} // namespace mach_o
+} // namespace lld
-} // mach_o
-} // lld
-
-#endif
+#endif // LLD_READER_WRITER_MACHO_ATOMS_H
Modified: lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h Thu Sep 10 13:51:36 2015
@@ -48,7 +48,7 @@ public:
/// Sorts atoms in mergedFile by content type then by command line order.
std::error_code perform(SimpleFile &mergedFile) override;
- virtual ~LayoutPass() {}
+ ~LayoutPass() override = default;
private:
// Build the followOn atoms chain as specified by the kindLayoutAfter
Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=247323&r1=247322&r2=247323&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Thu Sep 10 13:51:36 2015
@@ -255,7 +255,7 @@ struct RefKind {
Reference::KindValue value;
};
-} // namespace anon
+} // anonymous namespace
LLVM_YAML_IS_SEQUENCE_VECTOR(ArchMember)
LLVM_YAML_IS_SEQUENCE_VECTOR(const lld::Reference *)
@@ -585,16 +585,20 @@ template <> struct MappingTraits<const l
const AtomVector<lld::DefinedAtom> &defined() const override {
return _noDefinedAtoms;
}
+
const AtomVector<lld::UndefinedAtom> &undefined() const override {
return _noUndefinedAtoms;
}
- virtual const AtomVector<lld::SharedLibraryAtom> &
+
+ const AtomVector<lld::SharedLibraryAtom> &
sharedLibrary() const override {
return _noSharedLibraryAtoms;
}
+
const AtomVector<lld::AbsoluteAtom> &absolute() const override {
return _noAbsoluteAtoms;
}
+
File *find(StringRef name, bool dataSymbolOnly) override {
for (const ArchMember &member : _members) {
for (const lld::DefinedAtom *atom : member._content->defined()) {
@@ -614,7 +618,7 @@ template <> struct MappingTraits<const l
return nullptr;
}
- virtual std::error_code
+ std::error_code
parseAllMembers(std::vector<std::unique_ptr<File>> &result) override {
return std::error_code();
}
@@ -643,13 +647,16 @@ template <> struct MappingTraits<const l
const AtomVector<lld::DefinedAtom> &defined() const override {
return _definedAtoms._atoms;
}
+
const AtomVector<lld::UndefinedAtom> &undefined() const override {
return _undefinedAtoms._atoms;
}
- virtual const AtomVector<lld::SharedLibraryAtom> &
+
+ const AtomVector<lld::SharedLibraryAtom> &
sharedLibrary() const override {
return _sharedLibraryAtoms._atoms;
}
+
const AtomVector<lld::AbsoluteAtom> &absolute() const override {
return _absoluteAtoms._atoms;
}
@@ -1271,7 +1278,6 @@ class NativeYamlIOTaggedDocumentHandler
}
};
-
/// Handles !archive tagged yaml documents.
class ArchiveYamlIOTaggedDocumentHandler : public YamlIOTaggedDocumentHandler {
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override {
@@ -1283,8 +1289,6 @@ class ArchiveYamlIOTaggedDocumentHandler
}
};
-
-
class YAMLReader : public Reader {
public:
YAMLReader(const Registry ®istry) : _registry(registry) {}
More information about the llvm-commits
mailing list