forked from OSchip/llvm-project
Add "override" and remove "virtual" where appropriate.
For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
This commit is contained in:
parent
9cce17a23a
commit
16e543bc02
|
@ -243,15 +243,15 @@ public:
|
|||
return make_range(_elements.begin(), _elements.end());
|
||||
}
|
||||
|
||||
virtual void resetNextIndex() {
|
||||
void resetNextIndex() override {
|
||||
_currentElementIndex = _nextElementIndex = 0;
|
||||
for (auto &elem : _elements)
|
||||
elem->resetNextIndex();
|
||||
}
|
||||
|
||||
virtual uint32_t getResolveState() const;
|
||||
uint32_t getResolveState() const override;
|
||||
|
||||
virtual void setResolveState(uint32_t);
|
||||
void setResolveState(uint32_t) override;
|
||||
|
||||
protected:
|
||||
ControlKind _controlKind;
|
||||
|
@ -307,15 +307,15 @@ public:
|
|||
|
||||
/// \brief Reset the file index if the resolver needs to process
|
||||
/// the node again.
|
||||
virtual void resetNextIndex();
|
||||
void resetNextIndex() override;
|
||||
|
||||
/// \brief Set the resolve state for the FileNode.
|
||||
virtual void setResolveState(uint32_t resolveState) {
|
||||
void setResolveState(uint32_t resolveState) override {
|
||||
_resolveState = resolveState;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the resolve state of the FileNode.
|
||||
virtual uint32_t getResolveState() const { return _resolveState; }
|
||||
uint32_t getResolveState() const override { return _resolveState; }
|
||||
|
||||
protected:
|
||||
/// \brief Read the file into _buffer.
|
||||
|
@ -344,12 +344,12 @@ public:
|
|||
}
|
||||
|
||||
/// \brief Process input element and add it to the group
|
||||
virtual bool processInputElement(std::unique_ptr<InputElement> element) {
|
||||
bool processInputElement(std::unique_ptr<InputElement> element) override {
|
||||
_elements.push_back(std::move(element));
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ErrorOr<File &> getNextFile();
|
||||
ErrorOr<File &> getNextFile() override;
|
||||
};
|
||||
|
||||
/// \brief Represents Internal Input files
|
||||
|
@ -365,26 +365,26 @@ public:
|
|||
}
|
||||
|
||||
/// \brief validates the Input Element
|
||||
virtual bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
/// \brief Dump the Input Element
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
/// \brief parse the input element
|
||||
virtual error_code parse(const LinkingContext &, raw_ostream &) {
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override {
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
/// \brief Return the next File thats part of this node to the
|
||||
/// resolver.
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
// Do nothing here.
|
||||
virtual void resetNextIndex() {}
|
||||
void resetNextIndex() override {}
|
||||
};
|
||||
} // namespace lld
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
// Wait for ~Latch.
|
||||
}
|
||||
|
||||
virtual void add(std::function<void()> f) {
|
||||
void add(std::function<void()> f) override {
|
||||
std::unique_lock<std::mutex> lock(_mutex);
|
||||
_workStack.push(f);
|
||||
lock.unlock();
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
/// Scans all Atoms looking for call-site uses of SharedLibraryAtoms
|
||||
/// and transfroms the call-site to call a stub instead using the
|
||||
/// helper methods below.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile);
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
|
||||
/// If true, the pass should use stubs for references
|
||||
/// to shared library symbols. If false, the pass
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
/// Scans all Atoms looking for pointer to SharedLibraryAtoms
|
||||
/// and transfroms them to a pointer to a GOT entry using the
|
||||
/// helper methods below.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile);
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
|
||||
/// If true, the pass will use GOT entries for references
|
||||
/// to shared library symbols. If false, the pass
|
||||
|
|
|
@ -85,23 +85,23 @@ private:
|
|||
public:
|
||||
MergedFile() : MutableFile("<linker-internal>") {}
|
||||
|
||||
virtual const atom_collection<DefinedAtom> &defined() const {
|
||||
const atom_collection<DefinedAtom> &defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
virtual const atom_collection<UndefinedAtom>& undefined() const {
|
||||
const atom_collection<UndefinedAtom>& undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<SharedLibraryAtom>& sharedLibrary() const {
|
||||
const atom_collection<SharedLibraryAtom>& sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
virtual const atom_collection<AbsoluteAtom>& absolute() const {
|
||||
const atom_collection<AbsoluteAtom>& absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
void addAtoms(std::vector<const Atom*>& atoms);
|
||||
|
||||
virtual void addAtom(const Atom& atom);
|
||||
virtual DefinedAtomRange definedAtoms();
|
||||
void addAtom(const Atom& atom) override;
|
||||
DefinedAtomRange definedAtoms() override;
|
||||
|
||||
private:
|
||||
atom_collection_vector<DefinedAtom> _definedAtoms;
|
||||
|
|
|
@ -33,13 +33,13 @@ public:
|
|||
: FileNode(path), _ctx(ctx) {}
|
||||
|
||||
/// \brief validates the Input Element
|
||||
virtual bool validate() {
|
||||
bool validate() override {
|
||||
(void)_ctx;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Parse the input file to lld::File.
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
|
||||
ErrorOr<StringRef> filePath = getPath(ctx);
|
||||
if (filePath.getError() == llvm::errc::no_such_file_or_directory)
|
||||
return make_error_code(llvm::errc::no_such_file_or_directory);
|
||||
|
@ -58,14 +58,14 @@ public:
|
|||
/// to resolve atoms. This iterates over all the files thats part
|
||||
/// of this node. Returns no_more_files when there are no files to be
|
||||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_files.size() == _nextFileIndex)
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
/// \brief Dump the Input Element
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
private:
|
||||
CoreLinkingContext &_ctx;
|
||||
|
|
|
@ -32,13 +32,13 @@ public:
|
|||
: FileNode(path), _ctx(ctx), _isWholeArchive(isWholeArchive) {}
|
||||
|
||||
/// \brief validates the Input Element
|
||||
virtual bool validate() {
|
||||
bool validate() override {
|
||||
(void)_ctx;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Parse the input file to lld::File.
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
|
||||
ErrorOr<StringRef> filePath = getPath(ctx);
|
||||
if (error_code ec = filePath.getError())
|
||||
return ec;
|
||||
|
@ -74,14 +74,14 @@ public:
|
|||
/// to resolve atoms. This iterates over all the files thats part
|
||||
/// of this node. Returns no_more_files when there are no files to be
|
||||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_files.size() == _nextFileIndex)
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
/// \brief Dump the Input Element
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
private:
|
||||
const MachOLinkingContext &_ctx;
|
||||
|
|
|
@ -35,16 +35,16 @@ public:
|
|||
_isWholeArchive(isWholeArchive), _asNeeded(asNeeded),
|
||||
_isDashlPrefix(dashlPrefix) {}
|
||||
|
||||
virtual ErrorOr<StringRef> getPath(const LinkingContext &ctx) const;
|
||||
ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;
|
||||
|
||||
/// \brief validates the Input Element
|
||||
virtual bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
/// \brief create an error string for printing purposes
|
||||
virtual std::string errStr(error_code);
|
||||
std::string errStr(error_code) override;
|
||||
|
||||
/// \brief Dump the Input Element
|
||||
virtual bool dump(raw_ostream &diagnostics) {
|
||||
bool dump(raw_ostream &diagnostics) override {
|
||||
diagnostics << "Name : " << *getPath(_elfLinkingContext) << "\n";
|
||||
diagnostics << "Type : "
|
||||
<< "ELF File"
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
}
|
||||
|
||||
/// \brief Parse the input file to lld::File.
|
||||
error_code parse(const LinkingContext &, raw_ostream &);
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override;
|
||||
|
||||
/// \brief This is used by Group Nodes, when there is a need to reset the
|
||||
/// the file to be processed next. When handling a group node that contains
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
/// to start processing files as part of the inputelement from beginning.
|
||||
/// reset the next file index to 0 only if the node is an archive library or
|
||||
/// a shared library
|
||||
virtual void resetNextIndex() {
|
||||
void resetNextIndex() override {
|
||||
if ((!_isWholeArchive && (_files[0]->kind() == File::kindArchiveLibrary)) ||
|
||||
(_files[0]->kind() == File::kindSharedLibrary))
|
||||
_nextFileIndex = 0;
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
/// to resolve atoms. This iterates over all the files thats part
|
||||
/// of this node. Returns no_more_files when there are no files to be
|
||||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
|
@ -101,16 +101,16 @@ public:
|
|||
: Group(ordinal), _elfLinkingContext(ctx) {}
|
||||
|
||||
/// \brief Validate the options
|
||||
virtual bool validate() {
|
||||
bool validate() override {
|
||||
(void)_elfLinkingContext;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Dump the ELFGroup
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
/// \brief Parse the group members.
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
|
||||
for (auto &ei : _elements)
|
||||
if (error_code ec = ei->parse(ctx, diagnostics))
|
||||
return ec;
|
||||
|
@ -130,19 +130,19 @@ public:
|
|||
{}
|
||||
|
||||
/// \brief Is this node part of resolution ?
|
||||
virtual bool isHidden() const { return true; }
|
||||
bool isHidden() const override { return true; }
|
||||
|
||||
/// \brief Validate the options
|
||||
virtual bool validate() {
|
||||
bool validate() override {
|
||||
(void)_elfLinkingContext;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Dump the Linker script.
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
/// \brief Parse the linker script.
|
||||
virtual error_code parse(const LinkingContext &, raw_ostream &);
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override;
|
||||
|
||||
protected:
|
||||
ELFLinkingContext &_elfLinkingContext;
|
||||
|
@ -157,32 +157,32 @@ public:
|
|||
ELFGNULdScript(ELFLinkingContext &ctx, StringRef userPath, int64_t ordinal)
|
||||
: GNULdScript(ctx, userPath, ordinal) {}
|
||||
|
||||
virtual error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics);
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override;
|
||||
|
||||
virtual ExpandType expandType() const {
|
||||
ExpandType expandType() const override {
|
||||
return InputElement::ExpandType::ExpandOnly;
|
||||
}
|
||||
|
||||
/// Unused functions for ELFGNULdScript Nodes.
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
}
|
||||
|
||||
/// Return the elements that we would want to expand with.
|
||||
range<InputGraph::InputElementIterT> expandElements() {
|
||||
range<InputGraph::InputElementIterT> expandElements() override {
|
||||
return make_range(_expandElements.begin(), _expandElements.end());
|
||||
}
|
||||
|
||||
virtual void setResolveState(uint32_t) {
|
||||
void setResolveState(uint32_t) override {
|
||||
llvm_unreachable("cannot use this function: setResolveState");
|
||||
}
|
||||
|
||||
virtual uint32_t getResolveState() const {
|
||||
uint32_t getResolveState() const override {
|
||||
llvm_unreachable("cannot use this function: getResolveState");
|
||||
}
|
||||
|
||||
// Do nothing here.
|
||||
virtual void resetNextIndex() {}
|
||||
void resetNextIndex() override {}
|
||||
|
||||
private:
|
||||
InputGraph::InputElementVectorT _expandElements;
|
||||
|
|
|
@ -30,18 +30,18 @@ public:
|
|||
PECOFFFileNode(PECOFFLinkingContext &ctx, StringRef path)
|
||||
: FileNode(path), _ctx(ctx) {}
|
||||
|
||||
virtual ErrorOr<StringRef> getPath(const LinkingContext &ctx) const;
|
||||
ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;
|
||||
|
||||
/// \brief Parse the input file to lld::File.
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics);
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override;
|
||||
|
||||
/// \brief validates the Input Element
|
||||
virtual bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
/// \brief Dump the Input Element
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
virtual ErrorOr<File &> getNextFile();
|
||||
ErrorOr<File &> getNextFile() override;
|
||||
|
||||
protected:
|
||||
const PECOFFLinkingContext &_ctx;
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
PECOFFLibraryNode(PECOFFLinkingContext &ctx, StringRef path)
|
||||
: PECOFFFileNode(ctx, path) {}
|
||||
|
||||
virtual ErrorOr<StringRef> getPath(const LinkingContext &ctx) const;
|
||||
ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;
|
||||
};
|
||||
|
||||
/// \brief Represents a ELF control node
|
||||
|
@ -61,11 +61,11 @@ class PECOFFGroup : public Group {
|
|||
public:
|
||||
PECOFFGroup() : Group(0) {}
|
||||
|
||||
virtual bool validate() { return true; }
|
||||
virtual bool dump(raw_ostream &) { return true; }
|
||||
bool validate() override { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
/// \brief Parse the group members.
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
|
||||
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
|
||||
for (auto &elem : _elements)
|
||||
if (error_code ec = elem->parse(ctx, diagnostics))
|
||||
return ec;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
LayoutPass(const Registry ®istry);
|
||||
|
||||
/// Sorts atoms in mergedFile by content type then by command line order.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile);
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
|
||||
virtual ~LayoutPass() {}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
/// Writes to a native file and reads the atoms from the native file back.
|
||||
/// Replaces mergedFile with the contents of the native File.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile);
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
|
||||
virtual ~RoundTripNativePass() {}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
/// Writes to a YAML file and reads the atoms from the YAML file back.
|
||||
/// Replaces the mergedFile with new contents.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile);
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
|
||||
virtual ~RoundTripYAMLPass() {}
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ public:
|
|||
TEST_RELOC_LEA32_WAS_GOT = 5,
|
||||
};
|
||||
|
||||
virtual bool validateImpl(raw_ostream &diagnostics);
|
||||
virtual void addPasses(PassManager &pm);
|
||||
bool validateImpl(raw_ostream &diagnostics) override;
|
||||
void addPasses(PassManager &pm) override;
|
||||
|
||||
void addPassNamed(StringRef name) { _passNames.push_back(name); }
|
||||
|
||||
protected:
|
||||
virtual Writer &writer() const;
|
||||
Writer &writer() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Writer> _writer;
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
const Reference &) const {
|
||||
return false;
|
||||
}
|
||||
virtual bool validateImpl(raw_ostream &diagnostics);
|
||||
bool validateImpl(raw_ostream &diagnostics) override;
|
||||
|
||||
/// \brief Does the linker allow dynamic libraries to be linked with ?
|
||||
/// This is true when the output mode of the executable is set to be
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
}
|
||||
|
||||
TargetHandlerBase *targetHandler() const { return _targetHandler.get(); }
|
||||
virtual void addPasses(PassManager &pm);
|
||||
void addPasses(PassManager &pm) override;
|
||||
|
||||
void setTriple(llvm::Triple trip) { _triple = trip; }
|
||||
void setNoInhibitExec(bool v) { _noInhibitExec = v; }
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
ErrorOr<StringRef> searchLibrary(StringRef libName) const;
|
||||
|
||||
/// Get the entry symbol name
|
||||
virtual StringRef entrySymbolName() const;
|
||||
StringRef entrySymbolName() const override;
|
||||
|
||||
/// add to the list of initializer functions
|
||||
void addInitFunction(StringRef name) { _initFunctions.push_back(name); }
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
return _rpathLinkList;
|
||||
}
|
||||
|
||||
virtual bool addUndefinedAtomsFromSharedLibrary(const SharedLibraryFile *s) {
|
||||
bool addUndefinedAtomsFromSharedLibrary(const SharedLibraryFile *s) override {
|
||||
if (_undefinedAtomsFromFile.find(s) != _undefinedAtomsFromFile.end())
|
||||
return false;
|
||||
_undefinedAtomsFromFile[s] = true;
|
||||
|
@ -245,10 +245,10 @@ private:
|
|||
protected:
|
||||
ELFLinkingContext(llvm::Triple, std::unique_ptr<TargetHandlerBase>);
|
||||
|
||||
virtual Writer &writer() const;
|
||||
Writer &writer() const override;
|
||||
|
||||
/// Method to create a internal file for an undefined symbol
|
||||
virtual std::unique_ptr<File> createUndefinedSymbolFile() const;
|
||||
std::unique_ptr<File> createUndefinedSymbolFile() const override;
|
||||
|
||||
uint16_t _outputELFType; // e.g ET_EXEC
|
||||
llvm::Triple _triple;
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
return c->getKind() == Kind::OutputFormat;
|
||||
}
|
||||
|
||||
virtual void dump(raw_ostream &os) const {
|
||||
void dump(raw_ostream &os) const override {
|
||||
os << "OUTPUT_FORMAT(";
|
||||
for (auto fb = _formats.begin(), fe = _formats.end(); fb != fe; ++fb) {
|
||||
if (fb != _formats.begin())
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
return c->getKind() == Kind::OutputArch;
|
||||
}
|
||||
|
||||
virtual void dump(raw_ostream &os) const {
|
||||
void dump(raw_ostream &os) const override {
|
||||
os << "OUTPUT_arch(" << getArch() << ")\n";
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
static bool classof(const Command *c) { return c->getKind() == Kind::Group; }
|
||||
|
||||
virtual void dump(raw_ostream &os) const {
|
||||
void dump(raw_ostream &os) const override {
|
||||
os << "GROUP(";
|
||||
bool first = true;
|
||||
for (const auto &path : getPaths()) {
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
return c->getKind() == Kind::Entry;
|
||||
}
|
||||
|
||||
virtual void dump(raw_ostream &os) const {
|
||||
void dump(raw_ostream &os) const override {
|
||||
os << "ENTRY(" << _entryName << ")\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ public:
|
|||
/// other setXXX() methods.
|
||||
void configure(HeaderFileType type, Arch arch, OS os, uint32_t minOSVersion);
|
||||
|
||||
virtual void addPasses(PassManager &pm);
|
||||
virtual bool validateImpl(raw_ostream &diagnostics);
|
||||
void addPasses(PassManager &pm) override;
|
||||
bool validateImpl(raw_ostream &diagnostics) override;
|
||||
|
||||
uint32_t getCPUType() const;
|
||||
uint32_t getCPUSubType() const;
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
static bool parsePackedVersion(StringRef str, uint32_t &result);
|
||||
|
||||
private:
|
||||
virtual Writer &writer() const;
|
||||
Writer &writer() const override;
|
||||
|
||||
struct ArchInfo {
|
||||
StringRef archName;
|
||||
|
|
|
@ -72,13 +72,13 @@ public:
|
|||
/// \brief Casting support
|
||||
static inline bool classof(const LinkingContext *info) { return true; }
|
||||
|
||||
virtual Writer &writer() const;
|
||||
virtual bool validateImpl(raw_ostream &diagnostics);
|
||||
Writer &writer() const override;
|
||||
bool validateImpl(raw_ostream &diagnostics) override;
|
||||
|
||||
virtual void addPasses(PassManager &pm);
|
||||
void addPasses(PassManager &pm) override;
|
||||
|
||||
virtual bool
|
||||
createImplicitFiles(std::vector<std::unique_ptr<File> > &result) const;
|
||||
bool createImplicitFiles(
|
||||
std::vector<std::unique_ptr<File> > &result) const override;
|
||||
|
||||
bool is64Bit() const {
|
||||
return _machineType == llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
|
||||
|
@ -254,10 +254,10 @@ public:
|
|||
|
||||
protected:
|
||||
/// Method to create a internal file for the entry symbol
|
||||
virtual std::unique_ptr<File> createEntrySymbolFile() const;
|
||||
std::unique_ptr<File> createEntrySymbolFile() const override;
|
||||
|
||||
/// Method to create a internal file for an undefined symbol
|
||||
virtual std::unique_ptr<File> createUndefinedSymbolFile() const;
|
||||
std::unique_ptr<File> createUndefinedSymbolFile() const override;
|
||||
|
||||
private:
|
||||
enum : uint64_t {
|
||||
|
|
|
@ -25,7 +25,7 @@ class SimpleFile : public MutableFile {
|
|||
public:
|
||||
SimpleFile(StringRef path) : MutableFile(path) {}
|
||||
|
||||
virtual void addAtom(const Atom &atom) {
|
||||
void addAtom(const Atom &atom) override {
|
||||
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom)) {
|
||||
_definedAtoms._atoms.push_back(defAtom);
|
||||
} else if (
|
||||
|
@ -41,23 +41,23 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual const atom_collection<DefinedAtom> &defined() const {
|
||||
const atom_collection<DefinedAtom> &defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<UndefinedAtom> &undefined() const {
|
||||
const atom_collection<UndefinedAtom> &undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<SharedLibraryAtom> &sharedLibrary() const {
|
||||
const atom_collection<SharedLibraryAtom> &sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<AbsoluteAtom> &absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
virtual DefinedAtomRange definedAtoms() {
|
||||
DefinedAtomRange definedAtoms() override {
|
||||
return make_range(_definedAtoms._atoms);
|
||||
}
|
||||
|
||||
|
@ -91,15 +91,15 @@ public:
|
|||
: Reference(ns, arch, value), _target(t), _offsetInAtom(off), _addend(a) {
|
||||
}
|
||||
|
||||
virtual uint64_t offsetInAtom() const { return _offsetInAtom; }
|
||||
uint64_t offsetInAtom() const override { return _offsetInAtom; }
|
||||
|
||||
virtual const Atom *target() const { return _target; }
|
||||
const Atom *target() const override { return _target; }
|
||||
|
||||
virtual Addend addend() const { return _addend; }
|
||||
Addend addend() const override { return _addend; }
|
||||
|
||||
virtual void setAddend(Addend a) { _addend = a; }
|
||||
void setAddend(Addend a) override { _addend = a; }
|
||||
|
||||
virtual void setTarget(const Atom *newAtom) { _target = newAtom; }
|
||||
void setTarget(const Atom *newAtom) override { _target = newAtom; }
|
||||
private:
|
||||
const Atom *_target;
|
||||
uint64_t _offsetInAtom;
|
||||
|
@ -113,54 +113,54 @@ public:
|
|||
_ordinal = lastOrdinal++;
|
||||
}
|
||||
|
||||
virtual const File &file() const { return _file; }
|
||||
const File &file() const override { return _file; }
|
||||
|
||||
virtual StringRef name() const { return StringRef(); }
|
||||
StringRef name() const override { return StringRef(); }
|
||||
|
||||
virtual uint64_t ordinal() const { return _ordinal; }
|
||||
uint64_t ordinal() const override { return _ordinal; }
|
||||
|
||||
virtual Scope scope() const { return DefinedAtom::scopeLinkageUnit; }
|
||||
Scope scope() const override { return DefinedAtom::scopeLinkageUnit; }
|
||||
|
||||
virtual Interposable interposable() const { return DefinedAtom::interposeNo; }
|
||||
Interposable interposable() const override { return DefinedAtom::interposeNo; }
|
||||
|
||||
virtual Merge merge() const { return DefinedAtom::mergeNo; }
|
||||
Merge merge() const override { return DefinedAtom::mergeNo; }
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(0, 0); }
|
||||
Alignment alignment() const override { return Alignment(0, 0); }
|
||||
|
||||
virtual SectionChoice sectionChoice() const {
|
||||
SectionChoice sectionChoice() const override {
|
||||
return DefinedAtom::sectionBasedOnContent;
|
||||
}
|
||||
|
||||
virtual SectionPosition sectionPosition() const {
|
||||
SectionPosition sectionPosition() const override {
|
||||
return DefinedAtom::sectionPositionAny;
|
||||
}
|
||||
|
||||
virtual StringRef customSectionName() const { return StringRef(); }
|
||||
virtual DeadStripKind deadStrip() const {
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
}
|
||||
|
||||
virtual bool isAlias() const { return false; }
|
||||
bool isAlias() const override { return false; }
|
||||
|
||||
virtual DefinedAtom::reference_iterator begin() const {
|
||||
DefinedAtom::reference_iterator begin() const override {
|
||||
uintptr_t index = 0;
|
||||
const void *it = reinterpret_cast<const void *>(index);
|
||||
return reference_iterator(*this, it);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::reference_iterator end() const {
|
||||
DefinedAtom::reference_iterator end() const override {
|
||||
uintptr_t index = _references.size();
|
||||
const void *it = reinterpret_cast<const void *>(index);
|
||||
return reference_iterator(*this, it);
|
||||
}
|
||||
|
||||
virtual const Reference *derefIterator(const void *it) const {
|
||||
const Reference *derefIterator(const void *it) const override {
|
||||
uintptr_t index = reinterpret_cast<uintptr_t>(it);
|
||||
assert(index < _references.size());
|
||||
return &_references[index];
|
||||
}
|
||||
|
||||
virtual void incrementIterator(const void *&it) const {
|
||||
void incrementIterator(const void *&it) const override {
|
||||
uintptr_t index = reinterpret_cast<uintptr_t>(it);
|
||||
++index;
|
||||
it = reinterpret_cast<const void *>(index);
|
||||
|
@ -187,13 +187,13 @@ public:
|
|||
}
|
||||
|
||||
/// file - returns the File that produced/owns this Atom
|
||||
virtual const File &file() const { return _file; }
|
||||
const File &file() const override { return _file; }
|
||||
|
||||
/// name - The name of the atom. For a function atom, it is the (mangled)
|
||||
/// name of the function.
|
||||
virtual StringRef name() const { return _name; }
|
||||
StringRef name() const override { return _name; }
|
||||
|
||||
virtual CanBeNull canBeNull() const { return UndefinedAtom::canBeNullNever; }
|
||||
CanBeNull canBeNull() const override { return UndefinedAtom::canBeNullNever; }
|
||||
|
||||
private:
|
||||
const File &_file;
|
||||
|
|
|
@ -15,11 +15,11 @@ using namespace lld;
|
|||
|
||||
class _NativeReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char* name() const {
|
||||
const char* name() const override {
|
||||
return "lld.native.reader";
|
||||
}
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
std::string message(int ev) const override {
|
||||
if (NativeReaderError(ev) == NativeReaderError::success)
|
||||
return "Success";
|
||||
if (NativeReaderError(ev) == NativeReaderError::unknown_file_format)
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
llvm::error_condition default_error_condition(int ev) const override {
|
||||
if (NativeReaderError(ev) == NativeReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
|
@ -50,11 +50,11 @@ const llvm::error_category &lld::native_reader_category() {
|
|||
|
||||
class _YamlReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char* name() const {
|
||||
const char* name() const override {
|
||||
return "lld.yaml.reader";
|
||||
}
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
std::string message(int ev) const override {
|
||||
if (YamlReaderError(ev) == YamlReaderError::success)
|
||||
return "Success";
|
||||
if (YamlReaderError(ev) == YamlReaderError::unknown_keyword)
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
llvm::error_condition default_error_condition(int ev) const override {
|
||||
if (YamlReaderError(ev) == YamlReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
|
@ -79,9 +79,9 @@ const llvm::error_category &lld::YamlReaderCategory() {
|
|||
|
||||
class _LinkerScriptReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char *name() const { return "lld.linker-script.reader"; }
|
||||
const char *name() const override { return "lld.linker-script.reader"; }
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
std::string message(int ev) const override {
|
||||
LinkerScriptReaderError e = LinkerScriptReaderError(ev);
|
||||
if (e == LinkerScriptReaderError::success)
|
||||
return "Success";
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
llvm::error_condition default_error_condition(int ev) const override {
|
||||
LinkerScriptReaderError e = LinkerScriptReaderError(ev);
|
||||
if (e == LinkerScriptReaderError::success)
|
||||
return llvm::errc::success;
|
||||
|
@ -107,16 +107,16 @@ const llvm::error_category &lld::LinkerScriptReaderCategory() {
|
|||
|
||||
class _InputGraphErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char *name() const { return "lld.inputGraph.parse"; }
|
||||
const char *name() const override { return "lld.inputGraph.parse"; }
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
std::string message(int ev) const override {
|
||||
if (InputGraphError(ev) == InputGraphError::success)
|
||||
return "Success";
|
||||
llvm_unreachable("An enumerator of InputGraphError does not have a "
|
||||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
llvm::error_condition default_error_condition(int ev) const override {
|
||||
if (InputGraphError(ev) == InputGraphError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
|
@ -130,9 +130,9 @@ const llvm::error_category &lld::InputGraphErrorCategory() {
|
|||
|
||||
class _ReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char *name() const { return "lld.inputGraph.parse"; }
|
||||
const char *name() const override { return "lld.inputGraph.parse"; }
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
std::string message(int ev) const override {
|
||||
if (ReaderError(ev) == ReaderError::success)
|
||||
return "Success";
|
||||
else if (ReaderError(ev) == ReaderError::unknown_file_format)
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
llvm::error_condition default_error_condition(int ev) const override {
|
||||
if (ReaderError(ev) == ReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
|
|
|
@ -29,57 +29,57 @@ public:
|
|||
_ordinal = lastOrdinal++;
|
||||
}
|
||||
|
||||
virtual const File &file() const { return _file; }
|
||||
const File &file() const override { return _file; }
|
||||
|
||||
virtual StringRef name() const { return StringRef(); }
|
||||
StringRef name() const override { return StringRef(); }
|
||||
|
||||
virtual uint64_t ordinal() const { return _ordinal; }
|
||||
uint64_t ordinal() const override { return _ordinal; }
|
||||
|
||||
virtual uint64_t size() const { return 0; }
|
||||
uint64_t size() const override { return 0; }
|
||||
|
||||
virtual Scope scope() const { return DefinedAtom::scopeLinkageUnit; }
|
||||
Scope scope() const override { return DefinedAtom::scopeLinkageUnit; }
|
||||
|
||||
virtual Interposable interposable() const { return DefinedAtom::interposeNo; }
|
||||
Interposable interposable() const override { return DefinedAtom::interposeNo; }
|
||||
|
||||
virtual Merge merge() const { return DefinedAtom::mergeNo; }
|
||||
Merge merge() const override { return DefinedAtom::mergeNo; }
|
||||
|
||||
virtual ContentType contentType() const { return DefinedAtom::typeStub; }
|
||||
ContentType contentType() const override { return DefinedAtom::typeStub; }
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(0, 0); }
|
||||
Alignment alignment() const override { return Alignment(0, 0); }
|
||||
|
||||
virtual SectionChoice sectionChoice() const {
|
||||
SectionChoice sectionChoice() const override {
|
||||
return DefinedAtom::sectionBasedOnContent;
|
||||
}
|
||||
|
||||
virtual StringRef customSectionName() const { return StringRef(); }
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
|
||||
virtual SectionPosition sectionPosition() const { return sectionPositionAny; }
|
||||
SectionPosition sectionPosition() const override { return sectionPositionAny; }
|
||||
|
||||
virtual DeadStripKind deadStrip() const {
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
}
|
||||
|
||||
virtual ContentPermissions permissions() const {
|
||||
ContentPermissions permissions() const override {
|
||||
return DefinedAtom::permR_X;
|
||||
}
|
||||
|
||||
virtual bool isAlias() const { return false; }
|
||||
bool isAlias() const override { return false; }
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const { return ArrayRef<uint8_t>(); }
|
||||
ArrayRef<uint8_t> rawContent() const override { return ArrayRef<uint8_t>(); }
|
||||
|
||||
virtual reference_iterator begin() const {
|
||||
reference_iterator begin() const override {
|
||||
return reference_iterator(*this, nullptr);
|
||||
}
|
||||
|
||||
virtual reference_iterator end() const {
|
||||
reference_iterator end() const override {
|
||||
return reference_iterator(*this, nullptr);
|
||||
}
|
||||
|
||||
virtual const Reference *derefIterator(const void *iter) const {
|
||||
const Reference *derefIterator(const void *iter) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void incrementIterator(const void *&iter) const {}
|
||||
void incrementIterator(const void *&iter) const override {}
|
||||
|
||||
private:
|
||||
const File &_file;
|
||||
|
@ -94,57 +94,57 @@ public:
|
|||
_ordinal = lastOrdinal++;
|
||||
}
|
||||
|
||||
virtual const File &file() const { return _file; }
|
||||
const File &file() const override { return _file; }
|
||||
|
||||
virtual StringRef name() const { return StringRef(); }
|
||||
StringRef name() const override { return StringRef(); }
|
||||
|
||||
virtual uint64_t ordinal() const { return _ordinal; }
|
||||
uint64_t ordinal() const override { return _ordinal; }
|
||||
|
||||
virtual uint64_t size() const { return 0; }
|
||||
uint64_t size() const override { return 0; }
|
||||
|
||||
virtual Scope scope() const { return DefinedAtom::scopeLinkageUnit; }
|
||||
Scope scope() const override { return DefinedAtom::scopeLinkageUnit; }
|
||||
|
||||
virtual Interposable interposable() const { return DefinedAtom::interposeNo; }
|
||||
Interposable interposable() const override { return DefinedAtom::interposeNo; }
|
||||
|
||||
virtual Merge merge() const { return DefinedAtom::mergeNo; }
|
||||
Merge merge() const override { return DefinedAtom::mergeNo; }
|
||||
|
||||
virtual ContentType contentType() const { return DefinedAtom::typeGOT; }
|
||||
ContentType contentType() const override { return DefinedAtom::typeGOT; }
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(3, 0); }
|
||||
Alignment alignment() const override { return Alignment(3, 0); }
|
||||
|
||||
virtual SectionChoice sectionChoice() const {
|
||||
SectionChoice sectionChoice() const override {
|
||||
return DefinedAtom::sectionBasedOnContent;
|
||||
}
|
||||
|
||||
virtual StringRef customSectionName() const { return StringRef(); }
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
|
||||
virtual SectionPosition sectionPosition() const { return sectionPositionAny; }
|
||||
SectionPosition sectionPosition() const override { return sectionPositionAny; }
|
||||
|
||||
virtual DeadStripKind deadStrip() const {
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
}
|
||||
|
||||
virtual ContentPermissions permissions() const {
|
||||
ContentPermissions permissions() const override {
|
||||
return DefinedAtom::permRW_;
|
||||
}
|
||||
|
||||
virtual bool isAlias() const { return false; }
|
||||
bool isAlias() const override { return false; }
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const { return ArrayRef<uint8_t>(); }
|
||||
ArrayRef<uint8_t> rawContent() const override { return ArrayRef<uint8_t>(); }
|
||||
|
||||
virtual reference_iterator begin() const {
|
||||
reference_iterator begin() const override {
|
||||
return reference_iterator(*this, nullptr);
|
||||
}
|
||||
|
||||
virtual reference_iterator end() const {
|
||||
reference_iterator end() const override {
|
||||
return reference_iterator(*this, nullptr);
|
||||
}
|
||||
|
||||
virtual const Reference *derefIterator(const void *iter) const {
|
||||
const Reference *derefIterator(const void *iter) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void incrementIterator(const void *&iter) const {}
|
||||
void incrementIterator(const void *&iter) const override {}
|
||||
|
||||
private:
|
||||
const File &_file;
|
||||
|
@ -155,28 +155,28 @@ class TestingPassFile : public SimpleFile {
|
|||
public:
|
||||
TestingPassFile(const LinkingContext &ctx) : SimpleFile("Testing pass") {}
|
||||
|
||||
virtual void addAtom(const Atom &atom) {
|
||||
void addAtom(const Atom &atom) override {
|
||||
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom))
|
||||
_definedAtoms._atoms.push_back(defAtom);
|
||||
else
|
||||
llvm_unreachable("atom has unknown definition kind");
|
||||
}
|
||||
|
||||
virtual DefinedAtomRange definedAtoms() {
|
||||
DefinedAtomRange definedAtoms() override {
|
||||
return range<std::vector<const DefinedAtom *>::iterator>(
|
||||
_definedAtoms._atoms.begin(), _definedAtoms._atoms.end());
|
||||
}
|
||||
|
||||
virtual const atom_collection<DefinedAtom> &defined() const {
|
||||
const atom_collection<DefinedAtom> &defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
virtual const atom_collection<UndefinedAtom> &undefined() const {
|
||||
const atom_collection<UndefinedAtom> &undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<SharedLibraryAtom> &sharedLibrary() const {
|
||||
const atom_collection<SharedLibraryAtom> &sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
virtual const atom_collection<AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<AbsoluteAtom> &absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
|
@ -192,21 +192,21 @@ class TestingStubsPass : public StubsPass {
|
|||
public:
|
||||
TestingStubsPass(const LinkingContext &ctx) : _file(TestingPassFile(ctx)) {}
|
||||
|
||||
virtual bool noTextRelocs() { return true; }
|
||||
bool noTextRelocs() override { return true; }
|
||||
|
||||
virtual bool isCallSite(const Reference &ref) {
|
||||
bool isCallSite(const Reference &ref) override {
|
||||
if (ref.kindNamespace() != Reference::KindNamespace::testing)
|
||||
return false;
|
||||
return (ref.kindValue() == CoreLinkingContext::TEST_RELOC_CALL32);
|
||||
}
|
||||
|
||||
virtual const DefinedAtom *getStub(const Atom &target) {
|
||||
const DefinedAtom *getStub(const Atom &target) override {
|
||||
const DefinedAtom *result = new TestingStubAtom(_file, target);
|
||||
_file.addAtom(*result);
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void addStubAtoms(MutableFile &mergedFile) {
|
||||
void addStubAtoms(MutableFile &mergedFile) override {
|
||||
for (const DefinedAtom *stub : _file.defined()) {
|
||||
mergedFile.addAtom(*stub);
|
||||
}
|
||||
|
@ -220,9 +220,9 @@ class TestingGOTPass : public GOTPass {
|
|||
public:
|
||||
TestingGOTPass(const LinkingContext &ctx) : _file(TestingPassFile(ctx)) {}
|
||||
|
||||
virtual bool noTextRelocs() { return true; }
|
||||
bool noTextRelocs() override { return true; }
|
||||
|
||||
virtual bool isGOTAccess(const Reference &ref, bool &canBypassGOT) {
|
||||
bool isGOTAccess(const Reference &ref, bool &canBypassGOT) override {
|
||||
if (ref.kindNamespace() != Reference::KindNamespace::testing)
|
||||
return false;
|
||||
switch (ref.kindValue()) {
|
||||
|
@ -236,13 +236,13 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) {
|
||||
void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) override {
|
||||
const_cast<Reference *>(ref)->setKindValue(
|
||||
targetIsNowGOT ? CoreLinkingContext::TEST_RELOC_PCREL32
|
||||
: CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
|
||||
}
|
||||
|
||||
virtual const DefinedAtom *makeGOTEntry(const Atom &target) {
|
||||
const DefinedAtom *makeGOTEntry(const Atom &target) override {
|
||||
return new TestingGOTAtom(_file, target);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace elf {
|
|||
class ArrayOrderPass : public Pass {
|
||||
public:
|
||||
ArrayOrderPass() : Pass() {}
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
void perform(std::unique_ptr<MutableFile> &mergedFile) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -698,7 +698,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual uint64_t size() const override {
|
||||
uint64_t size() const override {
|
||||
return _symbol->st_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
CommandLineUndefinedAtom(const File &f, StringRef name)
|
||||
: SimpleUndefinedAtom(f, name) {}
|
||||
|
||||
virtual CanBeNull canBeNull() const {
|
||||
CanBeNull canBeNull() const override {
|
||||
return CanBeNull::canBeNullAtBuildtime;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,11 +37,11 @@ public:
|
|||
_name += function;
|
||||
#endif
|
||||
}
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return ArrayRef<uint8_t>(hexagonInitFiniAtomContent, 4);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
Alignment alignment() const override { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonFiniAtom : public InitFiniAtom {
|
||||
|
@ -53,10 +53,10 @@ public:
|
|||
_name += function;
|
||||
#endif
|
||||
}
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return ArrayRef<uint8_t>(hexagonInitFiniAtomContent, 4);
|
||||
}
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
Alignment alignment() const override { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonInitFiniFile : public SimpleFile {
|
||||
|
|
|
@ -73,33 +73,33 @@ class HexagonGOTAtom : public GOTAtom {
|
|||
public:
|
||||
HexagonGOTAtom(const File &f) : GOTAtom(f, ".got") {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(hexagonGotAtomContent);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
Alignment alignment() const override { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonGOTPLTAtom : public GOTAtom {
|
||||
public:
|
||||
HexagonGOTPLTAtom(const File &f) : GOTAtom(f, ".got.plt") {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(hexagonGotPltAtomContent);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
Alignment alignment() const override { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonGOTPLT0Atom : public GOTAtom {
|
||||
public:
|
||||
HexagonGOTPLT0Atom(const File &f) : GOTAtom(f, ".got.plt") {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(hexagonGotPlt0AtomContent);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(3); }
|
||||
Alignment alignment() const override { return Alignment(3); }
|
||||
};
|
||||
|
||||
class HexagonPLT0Atom : public PLT0Atom {
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(hexagonPlt0AtomContent);
|
||||
}
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ class HexagonPLTAtom : public PLTAtom {
|
|||
public:
|
||||
HexagonPLTAtom(const File &f, StringRef secName) : PLTAtom(f, secName) {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(hexagonPltAtomContent);
|
||||
}
|
||||
};
|
||||
|
@ -180,7 +180,7 @@ public:
|
|||
///
|
||||
/// After all references are handled, the atoms created during that are all
|
||||
/// added to mf.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mf) {
|
||||
void perform(std::unique_ptr<MutableFile> &mf) override {
|
||||
// Process all references.
|
||||
for (const auto &atom : mf->defined())
|
||||
for (const auto &ref : *atom)
|
||||
|
|
|
@ -49,13 +49,13 @@ public:
|
|||
ELFObjectReader(bool atomizeStrings) : _atomizeStrings(atomizeStrings) {}
|
||||
|
||||
virtual bool canParse(file_magic magic, StringRef,
|
||||
const MemoryBuffer &) const {
|
||||
const MemoryBuffer &) const override {
|
||||
return (magic == llvm::sys::fs::file_magic::elf_relocatable);
|
||||
}
|
||||
|
||||
virtual error_code
|
||||
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
|
||||
std::vector<std::unique_ptr<File>> &result) const {
|
||||
std::vector<std::unique_ptr<File>> &result) const override {
|
||||
error_code ec;
|
||||
std::size_t maxAlignment =
|
||||
1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
|
||||
|
@ -76,13 +76,13 @@ public:
|
|||
ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
|
||||
|
||||
virtual bool canParse(file_magic magic, StringRef,
|
||||
const MemoryBuffer &) const {
|
||||
const MemoryBuffer &) const override {
|
||||
return (magic == llvm::sys::fs::file_magic::elf_shared_object);
|
||||
}
|
||||
|
||||
virtual error_code
|
||||
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
|
||||
std::vector<std::unique_ptr<File>> &result) const {
|
||||
std::vector<std::unique_ptr<File>> &result) const override {
|
||||
std::size_t maxAlignment =
|
||||
1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
|
||||
auto f = createELF<DynamicFileCreateELFTraits>(
|
||||
|
|
|
@ -1345,11 +1345,11 @@ public:
|
|||
this->_msize = this->_fsize;
|
||||
}
|
||||
|
||||
virtual void doPreFlight() override {
|
||||
void doPreFlight() override {
|
||||
// TODO: Generate a proper binary search table.
|
||||
}
|
||||
|
||||
virtual void finalize() override {
|
||||
void finalize() override {
|
||||
MergedSections<ELFT> *s = _layout.findOutputSection(".eh_frame");
|
||||
_ehFrameAddr = s ? s->virtualAddr() : 0;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ public:
|
|||
_name += function;
|
||||
#endif
|
||||
}
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(x86_64InitFiniAtomContent);
|
||||
}
|
||||
virtual Alignment alignment() const { return Alignment(3); }
|
||||
Alignment alignment() const override { return Alignment(3); }
|
||||
};
|
||||
|
||||
class X86_64FiniAtom : public InitFiniAtom {
|
||||
|
@ -53,11 +53,11 @@ public:
|
|||
_name += function;
|
||||
#endif
|
||||
}
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return makeArrayRef(x86_64InitFiniAtomContent);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(3); }
|
||||
Alignment alignment() const override { return Alignment(3); }
|
||||
};
|
||||
|
||||
class X86_64InitFiniFile : public SimpleFile {
|
||||
|
|
|
@ -55,7 +55,7 @@ class X86_64GOTAtom : public GOTAtom {
|
|||
public:
|
||||
X86_64GOTAtom(const File &f, StringRef secName) : GOTAtom(f, secName) {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return ArrayRef<uint8_t>(x86_64GotAtomContent, 8);
|
||||
}
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
_name = ".PLT0";
|
||||
#endif
|
||||
}
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return ArrayRef<uint8_t>(x86_64Plt0AtomContent, 16);
|
||||
}
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ class X86_64PLTAtom : public PLTAtom {
|
|||
public:
|
||||
X86_64PLTAtom(const File &f, StringRef secName) : PLTAtom(f, secName) {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
return ArrayRef<uint8_t>(x86_64PltAtomContent, 16);
|
||||
}
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ public:
|
|||
///
|
||||
/// After all references are handled, the atoms created during that are all
|
||||
/// added to mf.
|
||||
virtual void perform(std::unique_ptr<MutableFile> &mf) {
|
||||
void perform(std::unique_ptr<MutableFile> &mf) override {
|
||||
ScopedTask task(getDefaultDomain(), "X86-64 GOT/PLT Pass");
|
||||
// Process all references.
|
||||
for (const auto &atom : mf->defined())
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
/// \brief Check if any member of the archive contains an Atom with the
|
||||
/// specified name and return the File object for that member, or nullptr.
|
||||
virtual const File *find(StringRef name, bool dataSymbolOnly) const {
|
||||
const File *find(StringRef name, bool dataSymbolOnly) const override {
|
||||
auto member = _symbolMemberMap.find(name);
|
||||
if (member == _symbolMemberMap.end())
|
||||
return nullptr;
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
/// \brief parse each member
|
||||
virtual error_code
|
||||
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
|
||||
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
|
||||
for (auto mf = _archive->child_begin(), me = _archive->child_end();
|
||||
mf != me; ++mf) {
|
||||
if (error_code ec = instantiateMember(mf, result))
|
||||
|
@ -81,19 +81,19 @@ public:
|
|||
return error_code::success();
|
||||
}
|
||||
|
||||
virtual const atom_collection<DefinedAtom> &defined() const {
|
||||
const atom_collection<DefinedAtom> &defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<UndefinedAtom> &undefined() const {
|
||||
const atom_collection<UndefinedAtom> &undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<SharedLibraryAtom> &sharedLibrary() const {
|
||||
const atom_collection<SharedLibraryAtom> &sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
|
||||
virtual const atom_collection<AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<AbsoluteAtom> &absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
|
@ -203,13 +203,13 @@ public:
|
|||
ArchiveReader(bool logLoading) : _logLoading(logLoading) {}
|
||||
|
||||
virtual bool canParse(file_magic magic, StringRef,
|
||||
const MemoryBuffer &) const {
|
||||
const MemoryBuffer &) const override {
|
||||
return (magic == llvm::sys::fs::file_magic::archive);
|
||||
}
|
||||
|
||||
virtual error_code
|
||||
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®,
|
||||
std::vector<std::unique_ptr<File>> &result) const {
|
||||
std::vector<std::unique_ptr<File>> &result) const override {
|
||||
// Make Archive object which will be owned by FileArchive object.
|
||||
error_code ec;
|
||||
Archive *archive = new Archive(mb.get(), ec);
|
||||
|
|
|
@ -32,7 +32,7 @@ class MachOWriter : public Writer {
|
|||
public:
|
||||
MachOWriter(const MachOLinkingContext &ctxt) : _context(ctxt) { }
|
||||
|
||||
virtual error_code writeFile(const lld::File &file, StringRef path) {
|
||||
error_code writeFile(const lld::File &file, StringRef path) override {
|
||||
// Construct empty normalized file from atoms.
|
||||
ErrorOr<std::unique_ptr<NormalizedFile>> nFile =
|
||||
normalized::normalizedFromAtoms(file, _context);
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
return writeBinary(*nFile->get(), path);
|
||||
}
|
||||
|
||||
virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &r) {
|
||||
bool createImplicitFiles(std::vector<std::unique_ptr<File> > &r) override {
|
||||
if (_context.outputFileType() == llvm::MachO::MH_EXECUTE) {
|
||||
// When building main executables, add _main as required entry point.
|
||||
r.emplace_back(new CRuntimeFile(_context));
|
||||
|
|
|
@ -44,74 +44,74 @@ public:
|
|||
const NativeDefinedAtomIvarsV1* ivarData)
|
||||
: _file(&f), _ivarData(ivarData) { }
|
||||
|
||||
virtual const lld::File& file() const;
|
||||
const lld::File& file() const override;
|
||||
|
||||
virtual uint64_t ordinal() const;
|
||||
uint64_t ordinal() const override;
|
||||
|
||||
virtual StringRef name() const;
|
||||
StringRef name() const override;
|
||||
|
||||
virtual uint64_t size() const {
|
||||
uint64_t size() const override {
|
||||
return _ivarData->contentSize;
|
||||
}
|
||||
|
||||
virtual DefinedAtom::Scope scope() const {
|
||||
DefinedAtom::Scope scope() const override {
|
||||
return (DefinedAtom::Scope)(attributes().scope);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::Interposable interposable() const {
|
||||
DefinedAtom::Interposable interposable() const override {
|
||||
return (DefinedAtom::Interposable)(attributes().interposable);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::Merge merge() const {
|
||||
DefinedAtom::Merge merge() const override {
|
||||
return (DefinedAtom::Merge)(attributes().merge);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::ContentType contentType() const {
|
||||
DefinedAtom::ContentType contentType() const override {
|
||||
const NativeAtomAttributesV1& attr = attributes();
|
||||
return (DefinedAtom::ContentType)(attr.contentType);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::Alignment alignment() const {
|
||||
DefinedAtom::Alignment alignment() const override {
|
||||
return DefinedAtom::Alignment(attributes().align2, attributes().alignModulus);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::SectionChoice sectionChoice() const {
|
||||
DefinedAtom::SectionChoice sectionChoice() const override {
|
||||
return (DefinedAtom::SectionChoice)(
|
||||
attributes().sectionChoiceAndPosition >> 4);
|
||||
}
|
||||
|
||||
virtual StringRef customSectionName() const;
|
||||
StringRef customSectionName() const override;
|
||||
|
||||
virtual SectionPosition sectionPosition() const {
|
||||
SectionPosition sectionPosition() const override {
|
||||
return (DefinedAtom::SectionPosition)(
|
||||
attributes().sectionChoiceAndPosition & 0xF);
|
||||
}
|
||||
|
||||
virtual DefinedAtom::DeadStripKind deadStrip() const {
|
||||
DefinedAtom::DeadStripKind deadStrip() const override {
|
||||
return (DefinedAtom::DeadStripKind)(attributes().deadStrip);
|
||||
}
|
||||
|
||||
virtual DynamicExport dynamicExport() const {
|
||||
DynamicExport dynamicExport() const override {
|
||||
return (DynamicExport)attributes().dynamicExport;
|
||||
}
|
||||
|
||||
virtual DefinedAtom::ContentPermissions permissions() const {
|
||||
DefinedAtom::ContentPermissions permissions() const override {
|
||||
return (DefinedAtom::ContentPermissions)(attributes().permissions);
|
||||
}
|
||||
|
||||
virtual bool isAlias() const {
|
||||
bool isAlias() const override {
|
||||
return (attributes().alias != 0);
|
||||
}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const;
|
||||
ArrayRef<uint8_t> rawContent() const override;
|
||||
|
||||
virtual reference_iterator begin() const;
|
||||
reference_iterator begin() const override;
|
||||
|
||||
virtual reference_iterator end() const;
|
||||
reference_iterator end() const override;
|
||||
|
||||
virtual const Reference* derefIterator(const void*) const;
|
||||
const Reference* derefIterator(const void*) const override;
|
||||
|
||||
virtual void incrementIterator(const void*& it) const;
|
||||
void incrementIterator(const void*& it) const override;
|
||||
|
||||
private:
|
||||
const NativeAtomAttributesV1& attributes() const;
|
||||
|
@ -132,14 +132,14 @@ public:
|
|||
const NativeUndefinedAtomIvarsV1* ivarData)
|
||||
: _file(&f), _ivarData(ivarData) { }
|
||||
|
||||
virtual const lld::File& file() const;
|
||||
virtual StringRef name() const;
|
||||
const lld::File& file() const override;
|
||||
StringRef name() const override;
|
||||
|
||||
virtual CanBeNull canBeNull() const {
|
||||
CanBeNull canBeNull() const override {
|
||||
return (CanBeNull)(_ivarData->flags & 0x3);
|
||||
}
|
||||
|
||||
virtual const UndefinedAtom *fallback() const;
|
||||
const UndefinedAtom *fallback() const override;
|
||||
|
||||
private:
|
||||
const File *_file;
|
||||
|
@ -158,19 +158,19 @@ public:
|
|||
const NativeSharedLibraryAtomIvarsV1* ivarData)
|
||||
: _file(&f), _ivarData(ivarData) { }
|
||||
|
||||
virtual const lld::File& file() const;
|
||||
virtual StringRef name() const;
|
||||
virtual StringRef loadName() const;
|
||||
const lld::File& file() const override;
|
||||
StringRef name() const override;
|
||||
StringRef loadName() const override;
|
||||
|
||||
virtual bool canBeNullAtRuntime() const {
|
||||
bool canBeNullAtRuntime() const override {
|
||||
return (_ivarData->flags & 0x1);
|
||||
}
|
||||
|
||||
virtual Type type() const {
|
||||
Type type() const override {
|
||||
return (Type)_ivarData->type;
|
||||
}
|
||||
|
||||
virtual uint64_t size() const {
|
||||
uint64_t size() const override {
|
||||
return _ivarData->size;
|
||||
}
|
||||
|
||||
|
@ -190,13 +190,13 @@ public:
|
|||
const NativeAbsoluteAtomIvarsV1* ivarData)
|
||||
: _file(&f), _ivarData(ivarData) { }
|
||||
|
||||
virtual const lld::File& file() const;
|
||||
virtual StringRef name() const;
|
||||
virtual Scope scope() const {
|
||||
const lld::File& file() const override;
|
||||
StringRef name() const override;
|
||||
Scope scope() const override {
|
||||
const NativeAtomAttributesV1& attr = absAttributes();
|
||||
return (Scope)(attr.scope);
|
||||
}
|
||||
virtual uint64_t value() const {
|
||||
uint64_t value() const override {
|
||||
return _ivarData->value;
|
||||
}
|
||||
|
||||
|
@ -218,14 +218,14 @@ public:
|
|||
(KindArch)ivarData->kindArch, ivarData->kindValue),
|
||||
_file(&f), _ivarData(ivarData) {}
|
||||
|
||||
virtual uint64_t offsetInAtom() const {
|
||||
uint64_t offsetInAtom() const override {
|
||||
return _ivarData->offsetInAtom;
|
||||
}
|
||||
|
||||
virtual const Atom* target() const;
|
||||
virtual Addend addend() const;
|
||||
virtual void setTarget(const Atom* newAtom);
|
||||
virtual void setAddend(Addend a);
|
||||
const Atom* target() const override;
|
||||
Addend addend() const override;
|
||||
void setTarget(const Atom* newAtom) override;
|
||||
void setAddend(Addend a) override;
|
||||
|
||||
private:
|
||||
const File *_file;
|
||||
|
@ -244,14 +244,14 @@ public:
|
|||
(KindArch)ivarData->kindArch, ivarData->kindValue),
|
||||
_file(&f), _ivarData(ivarData) {}
|
||||
|
||||
virtual uint64_t offsetInAtom() const {
|
||||
uint64_t offsetInAtom() const override {
|
||||
return _ivarData->offsetInAtom;
|
||||
}
|
||||
|
||||
virtual const Atom* target() const;
|
||||
virtual Addend addend() const;
|
||||
virtual void setTarget(const Atom* newAtom);
|
||||
virtual void setAddend(Addend a);
|
||||
const Atom* target() const override;
|
||||
Addend addend() const override;
|
||||
void setTarget(const Atom* newAtom) override;
|
||||
void setAddend(Addend a) override;
|
||||
|
||||
private:
|
||||
const File *_file;
|
||||
|
@ -384,16 +384,16 @@ public:
|
|||
delete [] _targetsTable;
|
||||
}
|
||||
|
||||
virtual const atom_collection<DefinedAtom>& defined() const {
|
||||
const atom_collection<DefinedAtom>& defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
virtual const atom_collection<UndefinedAtom>& undefined() const {
|
||||
const atom_collection<UndefinedAtom>& undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<SharedLibraryAtom>& sharedLibrary() const {
|
||||
const atom_collection<SharedLibraryAtom>& sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
virtual const atom_collection<AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<AbsoluteAtom> &absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ namespace {
|
|||
class NativeReader : public Reader {
|
||||
public:
|
||||
virtual bool canParse(file_magic magic, StringRef,
|
||||
const MemoryBuffer &mb) const {
|
||||
const MemoryBuffer &mb) const override {
|
||||
const NativeFileHeader *const header =
|
||||
reinterpret_cast<const NativeFileHeader *>(mb.getBufferStart());
|
||||
return (memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC,
|
||||
|
@ -1012,7 +1012,7 @@ public:
|
|||
|
||||
virtual error_code
|
||||
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
|
||||
std::vector<std::unique_ptr<File>> &result) const {
|
||||
std::vector<std::unique_ptr<File>> &result) const override {
|
||||
return lld::native::File::make(std::move(mb), result);
|
||||
return error_code::success();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class Writer : public lld::Writer {
|
|||
public:
|
||||
Writer(const LinkingContext &context) {}
|
||||
|
||||
virtual error_code writeFile(const lld::File &file, StringRef outPath) {
|
||||
error_code writeFile(const lld::File &file, StringRef outPath) override {
|
||||
// reserve first byte for unnamed atoms
|
||||
_stringPool.push_back('\0');
|
||||
// visit all atoms
|
||||
|
|
|
@ -564,20 +564,20 @@ template <> struct MappingTraits<const lld::File *> {
|
|||
|
||||
const lld::File *denormalize(IO &io) { return this; }
|
||||
|
||||
virtual const atom_collection<lld::DefinedAtom> &defined() const {
|
||||
const atom_collection<lld::DefinedAtom> &defined() const override {
|
||||
return _noDefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::UndefinedAtom> &undefined() const {
|
||||
const atom_collection<lld::UndefinedAtom> &undefined() const override {
|
||||
return _noUndefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::SharedLibraryAtom> &
|
||||
sharedLibrary() const {
|
||||
sharedLibrary() const override {
|
||||
return _noSharedLibraryAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<lld::AbsoluteAtom> &absolute() const override {
|
||||
return _noAbsoluteAtoms;
|
||||
}
|
||||
virtual const File *find(StringRef name, bool dataSymbolOnly) const {
|
||||
const File *find(StringRef name, bool dataSymbolOnly) const override {
|
||||
for (const ArchMember &member : _members) {
|
||||
for (const lld::DefinedAtom *atom : member._content->defined()) {
|
||||
if (name == atom->name()) {
|
||||
|
@ -597,7 +597,7 @@ template <> struct MappingTraits<const lld::File *> {
|
|||
}
|
||||
|
||||
virtual error_code
|
||||
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
|
||||
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
|
@ -622,17 +622,17 @@ template <> struct MappingTraits<const lld::File *> {
|
|||
}
|
||||
const lld::File *denormalize(IO &io);
|
||||
|
||||
virtual const atom_collection<lld::DefinedAtom> &defined() const {
|
||||
const atom_collection<lld::DefinedAtom> &defined() const override {
|
||||
return _definedAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::UndefinedAtom> &undefined() const {
|
||||
const atom_collection<lld::UndefinedAtom> &undefined() const override {
|
||||
return _undefinedAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::SharedLibraryAtom> &
|
||||
sharedLibrary() const {
|
||||
sharedLibrary() const override {
|
||||
return _sharedLibraryAtoms;
|
||||
}
|
||||
virtual const atom_collection<lld::AbsoluteAtom> &absolute() const {
|
||||
const atom_collection<lld::AbsoluteAtom> &absolute() const override {
|
||||
return _absoluteAtoms;
|
||||
}
|
||||
|
||||
|
@ -727,11 +727,11 @@ template <> struct MappingTraits<const lld::Reference *> {
|
|||
void bind(const RefNameResolver &);
|
||||
static StringRef targetName(IO &io, const lld::Reference *ref);
|
||||
|
||||
virtual uint64_t offsetInAtom() const { return _offset; }
|
||||
virtual const lld::Atom *target() const { return _target; }
|
||||
virtual Addend addend() const { return _addend; }
|
||||
virtual void setAddend(Addend a) { _addend = a; }
|
||||
virtual void setTarget(const lld::Atom *a) { _target = a; }
|
||||
uint64_t offsetInAtom() const override { return _offset; }
|
||||
const lld::Atom *target() const override { return _target; }
|
||||
Addend addend() const override { return _addend; }
|
||||
void setAddend(Addend a) override { _addend = a; }
|
||||
void setTarget(const lld::Atom *a) override { _target = a; }
|
||||
|
||||
const lld::Atom *_target;
|
||||
StringRef _targetName;
|
||||
|
@ -806,46 +806,46 @@ template <> struct MappingTraits<const lld::DefinedAtom *> {
|
|||
return *info->_file;
|
||||
}
|
||||
|
||||
virtual const lld::File &file() const { return _file; }
|
||||
virtual StringRef name() const { return _name; }
|
||||
virtual uint64_t size() const { return _size; }
|
||||
virtual Scope scope() const { return _scope; }
|
||||
virtual Interposable interposable() const { return _interpose; }
|
||||
virtual Merge merge() const { return _merge; }
|
||||
virtual ContentType contentType() const { return _contentType; }
|
||||
virtual Alignment alignment() const { return _alignment; }
|
||||
virtual SectionChoice sectionChoice() const { return _sectionChoice; }
|
||||
virtual StringRef customSectionName() const { return _sectionName; }
|
||||
virtual SectionPosition sectionPosition() const { return _sectionPosition; }
|
||||
virtual DeadStripKind deadStrip() const { return _deadStrip; }
|
||||
virtual DynamicExport dynamicExport() const { return _dynamicExport; }
|
||||
virtual ContentPermissions permissions() const { return _permissions; }
|
||||
virtual bool isAlias() const { return false; }
|
||||
ArrayRef<uint8_t> rawContent() const {
|
||||
const lld::File &file() const override { return _file; }
|
||||
StringRef name() const override { return _name; }
|
||||
uint64_t size() const override { return _size; }
|
||||
Scope scope() const override { return _scope; }
|
||||
Interposable interposable() const override { return _interpose; }
|
||||
Merge merge() const override { return _merge; }
|
||||
ContentType contentType() const override { return _contentType; }
|
||||
Alignment alignment() const override { return _alignment; }
|
||||
SectionChoice sectionChoice() const override { return _sectionChoice; }
|
||||
StringRef customSectionName() const override { return _sectionName; }
|
||||
SectionPosition sectionPosition() const override { return _sectionPosition; }
|
||||
DeadStripKind deadStrip() const override { return _deadStrip; }
|
||||
DynamicExport dynamicExport() const override { return _dynamicExport; }
|
||||
ContentPermissions permissions() const override { return _permissions; }
|
||||
bool isAlias() const override { return false; }
|
||||
ArrayRef<uint8_t> rawContent() const override {
|
||||
if (!occupiesDiskSpace())
|
||||
return ArrayRef<uint8_t>();
|
||||
return ArrayRef<uint8_t>(
|
||||
reinterpret_cast<const uint8_t *>(_content.data()), _content.size());
|
||||
}
|
||||
|
||||
virtual uint64_t ordinal() const { return _ordinal; }
|
||||
uint64_t ordinal() const override { return _ordinal; }
|
||||
|
||||
reference_iterator begin() const {
|
||||
reference_iterator begin() const override {
|
||||
uintptr_t index = 0;
|
||||
const void *it = reinterpret_cast<const void *>(index);
|
||||
return reference_iterator(*this, it);
|
||||
}
|
||||
reference_iterator end() const {
|
||||
reference_iterator end() const override {
|
||||
uintptr_t index = _references.size();
|
||||
const void *it = reinterpret_cast<const void *>(index);
|
||||
return reference_iterator(*this, it);
|
||||
}
|
||||
const lld::Reference *derefIterator(const void *it) const {
|
||||
const lld::Reference *derefIterator(const void *it) const override {
|
||||
uintptr_t index = reinterpret_cast<uintptr_t>(it);
|
||||
assert(index < _references.size());
|
||||
return _references[index];
|
||||
}
|
||||
void incrementIterator(const void *&it) const {
|
||||
void incrementIterator(const void *&it) const override {
|
||||
uintptr_t index = reinterpret_cast<uintptr_t>(it);
|
||||
++index;
|
||||
it = reinterpret_cast<const void *>(index);
|
||||
|
@ -953,10 +953,10 @@ template <> struct MappingTraits<const lld::UndefinedAtom *> {
|
|||
return *info->_file;
|
||||
}
|
||||
|
||||
virtual const lld::File &file() const { return _file; }
|
||||
virtual StringRef name() const { return _name; }
|
||||
virtual CanBeNull canBeNull() const { return _canBeNull; }
|
||||
virtual const UndefinedAtom *fallback() const { return _fallback; }
|
||||
const lld::File &file() const override { return _file; }
|
||||
StringRef name() const override { return _name; }
|
||||
CanBeNull canBeNull() const override { return _canBeNull; }
|
||||
const UndefinedAtom *fallback() const override { return _fallback; }
|
||||
|
||||
const lld::File &_file;
|
||||
StringRef _name;
|
||||
|
@ -1014,12 +1014,12 @@ template <> struct MappingTraits<const lld::SharedLibraryAtom *> {
|
|||
return *info->_file;
|
||||
}
|
||||
|
||||
virtual const lld::File &file() const { return _file; }
|
||||
virtual StringRef name() const { return _name; }
|
||||
virtual StringRef loadName() const { return _loadName; }
|
||||
virtual bool canBeNullAtRuntime() const { return _canBeNull; }
|
||||
virtual Type type() const { return _type; }
|
||||
virtual uint64_t size() const { return _size; }
|
||||
const lld::File &file() const override { return _file; }
|
||||
StringRef name() const override { return _name; }
|
||||
StringRef loadName() const override { return _loadName; }
|
||||
bool canBeNullAtRuntime() const override { return _canBeNull; }
|
||||
Type type() const override { return _type; }
|
||||
uint64_t size() const override { return _size; }
|
||||
|
||||
const lld::File &_file;
|
||||
StringRef _name;
|
||||
|
@ -1074,10 +1074,10 @@ template <> struct MappingTraits<const lld::AbsoluteAtom *> {
|
|||
return *info->_file;
|
||||
}
|
||||
|
||||
virtual const lld::File &file() const { return _file; }
|
||||
virtual StringRef name() const { return _name; }
|
||||
virtual uint64_t value() const { return _value; }
|
||||
virtual Scope scope() const { return _scope; }
|
||||
const lld::File &file() const override { return _file; }
|
||||
StringRef name() const override { return _name; }
|
||||
uint64_t value() const override { return _value; }
|
||||
Scope scope() const override { return _scope; }
|
||||
|
||||
const lld::File &_file;
|
||||
StringRef _name;
|
||||
|
@ -1190,7 +1190,7 @@ class Writer : public lld::Writer {
|
|||
public:
|
||||
Writer(const LinkingContext &context) : _context(context) {}
|
||||
|
||||
virtual error_code writeFile(const lld::File &file, StringRef outPath) {
|
||||
error_code writeFile(const lld::File &file, StringRef outPath) override {
|
||||
// Create stream to path.
|
||||
std::string errorInfo;
|
||||
llvm::raw_fd_ostream out(outPath.data(), errorInfo, llvm::sys::fs::F_Text);
|
||||
|
@ -1220,7 +1220,7 @@ namespace {
|
|||
|
||||
/// Handles !native tagged yaml documents.
|
||||
class NativeYamlIOTaggedDocumentHandler : public YamlIOTaggedDocumentHandler {
|
||||
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const {
|
||||
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override {
|
||||
if (io.mapTag("!native")) {
|
||||
MappingTraits<const lld::File *>::mappingAtoms(io, file);
|
||||
return true;
|
||||
|
@ -1232,7 +1232,7 @@ class NativeYamlIOTaggedDocumentHandler : public YamlIOTaggedDocumentHandler {
|
|||
|
||||
/// Handles !archive tagged yaml documents.
|
||||
class ArchiveYamlIOTaggedDocumentHandler : public YamlIOTaggedDocumentHandler {
|
||||
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const {
|
||||
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override {
|
||||
if (io.mapTag("!archive")) {
|
||||
MappingTraits<const lld::File *>::mappingArchive(io, file);
|
||||
return true;
|
||||
|
@ -1247,13 +1247,13 @@ class YAMLReader : public Reader {
|
|||
public:
|
||||
YAMLReader(const Registry ®istry) : _registry(registry) {}
|
||||
|
||||
virtual bool canParse(file_magic, StringRef ext, const MemoryBuffer &) const {
|
||||
bool canParse(file_magic, StringRef ext, const MemoryBuffer &) const override {
|
||||
return (ext.equals(".objtxt") || ext.equals(".yaml"));
|
||||
}
|
||||
|
||||
virtual error_code
|
||||
error_code
|
||||
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
|
||||
std::vector<std::unique_ptr<File>> &result) const {
|
||||
std::vector<std::unique_ptr<File>> &result) const override {
|
||||
// Note: we do not take ownership of the MemoryBuffer. That is
|
||||
// because yaml may produce multiple File objects, so there is no
|
||||
// *one* File to take ownership. Therefore, the yaml File objects
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace {
|
|||
class DarwinLdParserTest
|
||||
: public ParserTest<DarwinLdDriver, MachOLinkingContext> {
|
||||
protected:
|
||||
virtual const LinkingContext *linkingContext() { return &_context; }
|
||||
const LinkingContext *linkingContext() override { return &_context; }
|
||||
};
|
||||
|
||||
TEST_F(DarwinLdParserTest, Basic) {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
|||
class GnuLdParserTest
|
||||
: public ParserTest<GnuLdDriver, std::unique_ptr<ELFLinkingContext>> {
|
||||
protected:
|
||||
virtual const LinkingContext *linkingContext() { return _context.get(); }
|
||||
const LinkingContext *linkingContext() override { return _context.get(); }
|
||||
};
|
||||
|
||||
TEST_F(GnuLdParserTest, Empty) {
|
||||
|
|
|
@ -27,9 +27,9 @@ namespace {
|
|||
class MyLinkingContext : public LinkingContext {
|
||||
public:
|
||||
|
||||
virtual Writer &writer() const { llvm_unreachable("no writer!"); }
|
||||
Writer &writer() const override { llvm_unreachable("no writer!"); }
|
||||
|
||||
virtual bool validateImpl(raw_ostream &) { return true; }
|
||||
bool validateImpl(raw_ostream &) override { return true; }
|
||||
};
|
||||
|
||||
class MyInputGraph : public InputGraph {
|
||||
|
@ -41,15 +41,15 @@ class MyFileNode : public FileNode {
|
|||
public:
|
||||
MyFileNode(StringRef path, int64_t ordinal) : FileNode(path, ordinal) {}
|
||||
|
||||
bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
virtual error_code parse(const LinkingContext &, raw_ostream &) {
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override {
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
|
@ -60,11 +60,11 @@ class MyGroupNode : public Group {
|
|||
public:
|
||||
MyGroupNode(int64_t ordinal) : Group(ordinal) {}
|
||||
|
||||
bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
virtual error_code parse(const LinkingContext &, raw_ostream &) {
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override {
|
||||
return error_code::success();
|
||||
}
|
||||
};
|
||||
|
@ -77,25 +77,25 @@ public:
|
|||
_isHidden(isHidden)
|
||||
{}
|
||||
|
||||
bool validate() { return true; }
|
||||
bool validate() override { return true; }
|
||||
|
||||
bool dump(raw_ostream &) { return true; }
|
||||
bool dump(raw_ostream &) override { return true; }
|
||||
|
||||
virtual error_code parse(const LinkingContext &, raw_ostream &) {
|
||||
error_code parse(const LinkingContext &, raw_ostream &) override {
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
ErrorOr<File &> getNextFile() override {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
/// \brief How do we want to expand the current node ?
|
||||
virtual ExpandType expandType() const { return _expandType; }
|
||||
ExpandType expandType() const override { return _expandType; }
|
||||
|
||||
/// \brief Get the elements that we want to expand with.
|
||||
virtual range<InputGraph::InputElementIterT> expandElements() {
|
||||
range<InputGraph::InputElementIterT> expandElements() override {
|
||||
return make_range(_expandElements.begin(), _expandElements.end());
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
}
|
||||
|
||||
// Is hidden node
|
||||
virtual bool isHidden() const { return _isHidden; }
|
||||
bool isHidden() const override { return _isHidden; }
|
||||
|
||||
private:
|
||||
InputGraph::InputElementVectorT _expandElements;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace {
|
|||
class WinLinkParserTest
|
||||
: public ParserTest<WinLinkDriver, PECOFFLinkingContext> {
|
||||
protected:
|
||||
virtual const LinkingContext *linkingContext() { return &_context; }
|
||||
const LinkingContext *linkingContext() override { return &_context; }
|
||||
};
|
||||
|
||||
TEST_F(WinLinkParserTest, Basic) {
|
||||
|
|
Loading…
Reference in New Issue