diff options
30 files changed, 94 insertions, 94 deletions
diff --git a/lld/include/lld/Driver/CoreInputGraph.h b/lld/include/lld/Driver/CoreInputGraph.h index e1ef98b52c3..f24f5633f00 100644 --- a/lld/include/lld/Driver/CoreInputGraph.h +++ b/lld/include/lld/Driver/CoreInputGraph.h @@ -48,8 +48,8 @@ public: return make_error_code(llvm::errc::no_such_file_or_directory); // Create a memory buffer - OwningPtr<llvm::MemoryBuffer> opmb; - if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(*filePath, opmb)) + OwningPtr<MemoryBuffer> opmb; + if (error_code ec = MemoryBuffer::getFileOrSTDIN(*filePath, opmb)) return ec; std::unique_ptr<MemoryBuffer> mb(opmb.take()); diff --git a/lld/include/lld/Driver/DarwinInputGraph.h b/lld/include/lld/Driver/DarwinInputGraph.h index 9b0b1ba0d93..1b97c51eac4 100644 --- a/lld/include/lld/Driver/DarwinInputGraph.h +++ b/lld/include/lld/Driver/DarwinInputGraph.h @@ -41,13 +41,13 @@ public: } /// \brief Parse the input file to lld::File. - llvm::error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { + error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { // Read the file to _buffer. bool isYaml = false; if (error_code ec = readFile(ctx, diagnostics, isYaml)) return ec; (void) (_isWholeArchive); - return llvm::error_code::success(); + return error_code::success(); } /// \brief Return the file that has to be processed by the resolver diff --git a/lld/include/lld/Driver/GnuLdInputGraph.h b/lld/include/lld/Driver/GnuLdInputGraph.h index fa5a7d69a11..76720e801e2 100644 --- a/lld/include/lld/Driver/GnuLdInputGraph.h +++ b/lld/include/lld/Driver/GnuLdInputGraph.h @@ -48,7 +48,7 @@ public: virtual bool validate() { return true; } /// \brief create an error string for printing purposes - virtual std::string errStr(llvm::error_code); + virtual std::string errStr(error_code); /// \brief Dump the Input Element virtual bool dump(raw_ostream &diagnostics) { @@ -71,7 +71,7 @@ public: } /// \brief Parse the input file to lld::File. - llvm::error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { + error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { // Read the file to _buffer. bool isYaml = false; if (error_code ec = readFile(ctx, diagnostics, isYaml)) @@ -162,10 +162,10 @@ public: } /// \brief Dump the ELFGroup - virtual bool dump(llvm::raw_ostream &) { return true; } + virtual bool dump(raw_ostream &) { return true; } /// \brief Parse the group members. - llvm::error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { + error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { for (auto &ei : _elements) if (error_code ec = ei->parse(ctx, diagnostics)) return ec; diff --git a/lld/include/lld/Driver/InputGraph.h b/lld/include/lld/Driver/InputGraph.h index a975a24f611..0a7103c2f71 100644 --- a/lld/include/lld/Driver/InputGraph.h +++ b/lld/include/lld/Driver/InputGraph.h @@ -159,7 +159,7 @@ public: virtual bool dump(raw_ostream &diagnostics) = 0; /// \brief parse the input element - virtual llvm::error_code parse(const LinkingContext &, raw_ostream &) = 0; + virtual error_code parse(const LinkingContext &, raw_ostream &) = 0; /// \brief functions for the resolver to use @@ -263,20 +263,20 @@ public: } /// \brief create an error string for printing purposes - virtual std::string errStr(llvm::error_code errc) { + virtual std::string errStr(error_code errc) { std::string msg = errc.message(); Twine twine = Twine("Cannot open ") + _path + ": " + msg; return twine.str(); } /// \brief Memory buffer pointed by the file. - llvm::MemoryBuffer &getBuffer() const { + MemoryBuffer &getBuffer() const { assert(_buffer); return *_buffer; } /// \brief Return the memory buffer and transfer ownership. - std::unique_ptr<llvm::MemoryBuffer> takeBuffer() { + std::unique_ptr<MemoryBuffer> takeBuffer() { assert(_buffer); return std::move(_buffer); } @@ -314,7 +314,7 @@ protected: StringRef _path; // The path of the Input file InputGraph::FileVectorT _files; // A vector of lld File objects - std::unique_ptr<llvm::MemoryBuffer> _buffer; // Memory buffer to actual + std::unique_ptr<MemoryBuffer> _buffer; // Memory buffer to actual // contents uint32_t _resolveState; // The resolve state of the file uint32_t _nextFileIndex; // The next file that would be processed by the @@ -348,7 +348,7 @@ class SimpleFileNode : public InputElement { public: SimpleFileNode(StringRef path, int64_t ordinal = -1); - virtual llvm::ErrorOr<StringRef> path(const LinkingContext &) const { + virtual ErrorOr<StringRef> path(const LinkingContext &) const { return _path; } @@ -389,7 +389,7 @@ public: virtual bool dump(raw_ostream &) { return true; } /// \brief parse the input element - virtual llvm::error_code parse(const LinkingContext &, raw_ostream &) { + virtual error_code parse(const LinkingContext &, raw_ostream &) { return error_code::success(); } diff --git a/lld/include/lld/Driver/WinLinkInputGraph.h b/lld/include/lld/Driver/WinLinkInputGraph.h index c0eb035b468..d14f7691fa0 100644 --- a/lld/include/lld/Driver/WinLinkInputGraph.h +++ b/lld/include/lld/Driver/WinLinkInputGraph.h @@ -35,7 +35,7 @@ public: return a->kind() == InputElement::Kind::File; } - virtual llvm::ErrorOr<StringRef> getPath(const LinkingContext &ctx) const; + virtual ErrorOr<StringRef> getPath(const LinkingContext &ctx) const; /// \brief Parse the input file to lld::File. error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) { @@ -87,7 +87,7 @@ public: PECOFFLibraryNode(PECOFFLinkingContext &ctx, StringRef path) : PECOFFFileNode(ctx, path) {} - virtual llvm::ErrorOr<StringRef> getPath(const LinkingContext &ctx) const; + virtual ErrorOr<StringRef> getPath(const LinkingContext &ctx) const; }; } // namespace lld diff --git a/lld/include/lld/ReaderWriter/ELFLinkingContext.h b/lld/include/lld/ReaderWriter/ELFLinkingContext.h index 458ded2a0e0..ed8b4aca7dd 100644 --- a/lld/include/lld/ReaderWriter/ELFLinkingContext.h +++ b/lld/include/lld/ReaderWriter/ELFLinkingContext.h @@ -156,7 +156,7 @@ public: virtual void setNoAllowDynamicLibraries() { _noAllowDynamicLibraries = true; } /// Searches directories for a match on the input File - llvm::ErrorOr<StringRef> + ErrorOr<StringRef> searchLibrary(StringRef libName, const std::vector<StringRef> &searchPath) const; diff --git a/lld/include/lld/ReaderWriter/LinkerScript.h b/lld/include/lld/ReaderWriter/LinkerScript.h index 475ee434404..7a46dc6b52a 100644 --- a/lld/include/lld/ReaderWriter/LinkerScript.h +++ b/lld/include/lld/ReaderWriter/LinkerScript.h @@ -44,7 +44,7 @@ public: Token() : _kind(unknown) {} Token(StringRef range, Kind kind) : _range(range), _kind(kind) {} - void dump(llvm::raw_ostream &os) const; + void dump(raw_ostream &os) const; StringRef _range; Kind _kind; @@ -52,7 +52,7 @@ public: class Lexer { public: - explicit Lexer(std::unique_ptr<llvm::MemoryBuffer> mb) + explicit Lexer(std::unique_ptr<MemoryBuffer> mb) : _buffer(mb->getBuffer()) { _sourceManager.AddNewSourceBuffer(mb.release(), llvm::SMLoc()); } @@ -83,7 +83,7 @@ public: Kind getKind() const { return _kind; } - virtual void dump(llvm::raw_ostream &os) const = 0; + virtual void dump(raw_ostream &os) const = 0; virtual ~Command() {} @@ -103,7 +103,7 @@ public: return c->getKind() == Kind::OutputFormat; } - virtual void dump(llvm::raw_ostream &os) const { + virtual void dump(raw_ostream &os) const { os << "OUTPUT_FORMAT(" << getFormat() << ")\n"; } @@ -133,7 +133,7 @@ public: static bool classof(const Command *c) { return c->getKind() == Kind::Group; } - virtual void dump(llvm::raw_ostream &os) const { + virtual void dump(raw_ostream &os) const { os << "GROUP("; bool first = true; for (const auto &path : getPaths()) { @@ -165,7 +165,7 @@ public: return c->getKind() == Kind::Entry; } - virtual void dump(llvm::raw_ostream &os) const { + virtual void dump(raw_ostream &os) const { os << "ENTRY(" << _entryName << ")\n"; } @@ -179,7 +179,7 @@ private: class LinkerScript { public: - void dump(llvm::raw_ostream &os) const { + void dump(raw_ostream &os) const { for (const auto &c : _commands) c->dump(os); } diff --git a/lld/include/lld/ReaderWriter/ReaderLinkerScript.h b/lld/include/lld/ReaderWriter/ReaderLinkerScript.h index 823150107c1..0a1e3def300 100644 --- a/lld/include/lld/ReaderWriter/ReaderLinkerScript.h +++ b/lld/include/lld/ReaderWriter/ReaderLinkerScript.h @@ -25,7 +25,7 @@ public: /// \brief Returns a vector of Files that are contained in the archive file /// pointed to by the Memorybuffer - error_code parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb, + error_code parseFile(std::unique_ptr<MemoryBuffer> &mb, std::vector<std::unique_ptr<File> > &result) const; }; diff --git a/lld/lib/Core/PassManager.cpp b/lld/lib/Core/PassManager.cpp index a1dbe6ec85c..749a8947e7c 100644 --- a/lld/lib/Core/PassManager.cpp +++ b/lld/lib/Core/PassManager.cpp @@ -19,6 +19,6 @@ error_code PassManager::runOnFile(std::unique_ptr<MutableFile> &mf) { for (auto &pass : _passes) { pass->perform(mf); } - return llvm::error_code::success(); + return error_code::success(); } } // end namespace lld diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp index ea46109ee1d..f4012279d10 100644 --- a/lld/lib/Driver/Driver.cpp +++ b/lld/lib/Driver/Driver.cpp @@ -62,7 +62,7 @@ bool Driver::link(LinkingContext &context, raw_ostream &diagnostics) { llvm::raw_string_ostream stream(buf); if (error_code ec = ie->parse(context, stream)) { - FileNode *fileNode = llvm::dyn_cast<FileNode>(ie.get()); + FileNode *fileNode = dyn_cast<FileNode>(ie.get()); stream << fileNode->errStr(ec) << "\n"; fail = true; } diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp index 4a971fca069..be84467e3d9 100644 --- a/lld/lib/Driver/GnuLdDriver.cpp +++ b/lld/lib/Driver/GnuLdDriver.cpp @@ -75,7 +75,7 @@ llvm::ErrorOr<StringRef> ELFFileNode::getPath(const LinkingContext &) const { return _elfLinkingContext.searchLibrary(_path, _libraryPaths); } -std::string ELFFileNode::errStr(llvm::error_code errc) { +std::string ELFFileNode::errStr(error_code errc) { if (errc == llvm::errc::no_such_file_or_directory) { if (_isDashlPrefix) return (Twine("Unable to find library -l") + _path).str(); @@ -256,14 +256,14 @@ bool GnuLdDriver::parse(int argc, const char *argv[], case OPT_start_group: { std::unique_ptr<InputElement> controlStart(new ELFGroup(*ctx, index++)); controlNodeStack.push(controlStart.get()); - (llvm::dyn_cast<ControlNode>)(controlNodeStack.top()) + (dyn_cast<ControlNode>)(controlNodeStack.top()) ->processControlEnter(); inputGraph->addInputElement(std::move(controlStart)); break; } case OPT_end_group: - (llvm::dyn_cast<ControlNode>)(controlNodeStack.top()) + (dyn_cast<ControlNode>)(controlNodeStack.top()) ->processControlExit(); controlNodeStack.pop(); break; @@ -276,7 +276,7 @@ bool GnuLdDriver::parse(int argc, const char *argv[], if (controlNodeStack.empty()) inputGraph->addInputElement(std::move(inputFile)); else - (llvm::dyn_cast<ControlNode>)(controlNodeStack.top()) + (dyn_cast<ControlNode>)(controlNodeStack.top()) ->processInputElement(std::move(inputFile)); break; } diff --git a/lld/lib/Driver/InputGraph.cpp b/lld/lib/Driver/InputGraph.cpp index 4d19fbc43ac..eaf02eb24ad 100644 --- a/lld/lib/Driver/InputGraph.cpp +++ b/lld/lib/Driver/InputGraph.cpp @@ -107,9 +107,9 @@ FileNode::readFile(const LinkingContext &ctx, raw_ostream &diagnostics, return make_error_code(llvm::errc::no_such_file_or_directory); // Create a memory buffer - OwningPtr<llvm::MemoryBuffer> opmb; + OwningPtr<MemoryBuffer> opmb; - if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(*filePath, opmb)) + if (error_code ec = MemoryBuffer::getFileOrSTDIN(*filePath, opmb)) return ec; std::unique_ptr<MemoryBuffer> mb(opmb.take()); diff --git a/lld/lib/Passes/LayoutPass.cpp b/lld/lib/Passes/LayoutPass.cpp index cc3b60977ab..bc839b69e28 100644 --- a/lld/lib/Passes/LayoutPass.cpp +++ b/lld/lib/Passes/LayoutPass.cpp @@ -223,7 +223,7 @@ void LayoutPass::buildFollowOnTable(MutableFile::DefinedAtomRange &range) { for (const Reference *r : *ai) { if (r->kind() != lld::Reference::kindLayoutAfter) continue; - const DefinedAtom *targetAtom = llvm::dyn_cast<DefinedAtom>(r->target()); + const DefinedAtom *targetAtom = dyn_cast<DefinedAtom>(r->target()); _followOnNexts[ai] = targetAtom; // If we find a followon for the first time, lets make that atom as the @@ -283,7 +283,7 @@ void LayoutPass::buildInGroupTable(MutableFile::DefinedAtomRange &range) { for (const DefinedAtom *ai : range) { for (const Reference *r : *ai) { if (r->kind() == lld::Reference::kindInGroup) { - const DefinedAtom *rootAtom = llvm::dyn_cast<DefinedAtom>(r->target()); + const DefinedAtom *rootAtom = dyn_cast<DefinedAtom>(r->target()); // If the root atom is not part of any root // create a new root if (_followOnRoots.count(rootAtom) == 0) { @@ -355,7 +355,7 @@ void LayoutPass::buildPrecededByTable(MutableFile::DefinedAtomRange &range) { for (const DefinedAtom *ai : range) { for (const Reference *r : *ai) { if (r->kind() == lld::Reference::kindLayoutBefore) { - const DefinedAtom *targetAtom = llvm::dyn_cast<DefinedAtom>(r->target()); + const DefinedAtom *targetAtom = dyn_cast<DefinedAtom>(r->target()); // Is the targetAtom not chained if (_followOnRoots.count(targetAtom) == 0) { // Is the current atom not part of any root ? @@ -428,7 +428,7 @@ namespace { typedef llvm::DenseMap<const DefinedAtom *, const DefinedAtom *> AtomToAtomT; std::string atomToDebugString(const Atom *atom) { - const DefinedAtom *definedAtom = llvm::dyn_cast<DefinedAtom>(atom); + const DefinedAtom *definedAtom = dyn_cast<DefinedAtom>(atom); std::string str; llvm::raw_string_ostream s(str); if (definedAtom->name().empty()) diff --git a/lld/lib/Passes/RoundTripNativePass.cpp b/lld/lib/Passes/RoundTripNativePass.cpp index f78ad7bb5cb..e22b6207030 100644 --- a/lld/lib/Passes/RoundTripNativePass.cpp +++ b/lld/lib/Passes/RoundTripNativePass.cpp @@ -31,8 +31,8 @@ void RoundTripNativePass::perform(std::unique_ptr<MutableFile> &mergedFile) { // The file that is written would be kept around if there is a problem // writing to the file or when reading atoms back from the file. nativeWriter->writeFile(*mergedFile, tmpNativeFile.str()); - llvm::OwningPtr<llvm::MemoryBuffer> buff; - if (llvm::MemoryBuffer::getFileOrSTDIN(tmpNativeFile.str(), buff)) + OwningPtr<MemoryBuffer> buff; + if (MemoryBuffer::getFileOrSTDIN(tmpNativeFile.str(), buff)) return; std::unique_ptr<MemoryBuffer> mb(buff.take()); diff --git a/lld/lib/Passes/RoundTripYAMLPass.cpp b/lld/lib/Passes/RoundTripYAMLPass.cpp index 38012cd1308..79466b5cdb5 100644 --- a/lld/lib/Passes/RoundTripYAMLPass.cpp +++ b/lld/lib/Passes/RoundTripYAMLPass.cpp @@ -30,8 +30,8 @@ void RoundTripYAMLPass::perform(std::unique_ptr<MutableFile> &mergedFile) { // The file that is written would be kept around if there is a problem // writing to the file or when reading atoms back from the file. yamlWriter->writeFile(*mergedFile, tmpYAMLFile.str()); - llvm::OwningPtr<llvm::MemoryBuffer> buff; - if (llvm::MemoryBuffer::getFileOrSTDIN(tmpYAMLFile.str(), buff)) + OwningPtr<MemoryBuffer> buff; + if (MemoryBuffer::getFileOrSTDIN(tmpYAMLFile.str(), buff)) return; std::unique_ptr<MemoryBuffer> mb(buff.take()); diff --git a/lld/lib/ReaderWriter/ELF/Atoms.h b/lld/lib/ReaderWriter/ELF/Atoms.h index a7c14413506..d1153e7868c 100644 --- a/lld/lib/ReaderWriter/ELF/Atoms.h +++ b/lld/lib/ReaderWriter/ELF/Atoms.h @@ -170,7 +170,7 @@ public: StringRef sectionName, const Elf_Sym *symbol, const Elf_Shdr *section, - llvm::ArrayRef<uint8_t> contentData, + ArrayRef<uint8_t> contentData, unsigned int referenceStart, unsigned int referenceEnd, std::vector<ELFReference<ELFT>*> &referenceList) @@ -482,7 +482,7 @@ public: return false; } - virtual llvm::ArrayRef<uint8_t> rawContent() const { + virtual ArrayRef<uint8_t> rawContent() const { return _contentData; } @@ -525,7 +525,7 @@ private: const Elf_Sym *_symbol; const Elf_Shdr *_section; /// \brief Holds the bits that make up the atom. - llvm::ArrayRef<uint8_t> _contentData; + ArrayRef<uint8_t> _contentData; uint64_t _ordinal; unsigned int _referenceStartIndex; @@ -543,7 +543,7 @@ template <class ELFT> class ELFMergeAtom LLVM_FINAL : public DefinedAtom { public: ELFMergeAtom(const ELFFile<ELFT> &file, StringRef sectionName, - const Elf_Shdr *section, llvm::ArrayRef<uint8_t> contentData, + const Elf_Shdr *section, ArrayRef<uint8_t> contentData, uint64_t offset) : _owningFile(file), _sectionName(sectionName), _section(section), _contentData(contentData), _offset(offset) { @@ -593,7 +593,7 @@ public: virtual bool isAlias() const { return false; } - virtual llvm::ArrayRef<uint8_t> rawContent() const { return _contentData; } + virtual ArrayRef<uint8_t> rawContent() const { return _contentData; } DefinedAtom::reference_iterator begin() const { uintptr_t index = 0; @@ -617,7 +617,7 @@ private: StringRef _sectionName; const Elf_Shdr *_section; /// \brief Holds the bits that make up the atom. - llvm::ArrayRef<uint8_t> _contentData; + ArrayRef<uint8_t> _contentData; uint64_t _ordinal; uint64_t _offset; }; diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp index 6c7be8eef5c..10f91380467 100644 --- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -134,7 +134,7 @@ ELFLinkingContext::create(llvm::Triple triple) { } } -llvm::ErrorOr<StringRef> ELFLinkingContext::searchLibrary( +ErrorOr<StringRef> ELFLinkingContext::searchLibrary( StringRef libName, const std::vector<StringRef> &searchPath) const { bool foundFile = false; StringRef pathref; diff --git a/lld/lib/ReaderWriter/ELF/File.h b/lld/lib/ReaderWriter/ELF/File.h index 85f324f1e25..5bd9e37d01c 100644 --- a/lld/lib/ReaderWriter/ELF/File.h +++ b/lld/lib/ReaderWriter/ELF/File.h @@ -122,7 +122,7 @@ public: : File(name, kindObject), _elfLinkingContext(context) {} ELFFile(const ELFLinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> MB, llvm::error_code &EC) + std::unique_ptr<MemoryBuffer> MB, error_code &EC) : File(MB->getBufferIdentifier(), kindObject), _elfLinkingContext(context), _ordinal(0), _doStringsMerge(false) { _objFile.reset(new llvm::object::ELFFile<ELFT>(MB.release(), EC)); diff --git a/lld/lib/ReaderWriter/ELF/Reader.cpp b/lld/lib/ReaderWriter/ELF/Reader.cpp index 04ba5b27447..f1cd9f1cf03 100644 --- a/lld/lib/ReaderWriter/ELF/Reader.cpp +++ b/lld/lib/ReaderWriter/ELF/Reader.cpp @@ -90,7 +90,7 @@ public: std::size_t MaxAlignment = 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart())); - llvm::error_code ec; + error_code ec; switch (FileType) { case llvm::sys::fs::file_magic::elf_relocatable: { std::unique_ptr<File> f(createELF<ELFFileCreateELFTraits>( diff --git a/lld/lib/ReaderWriter/ELF/SectionChunks.h b/lld/lib/ReaderWriter/ELF/SectionChunks.h index 2316d46bebf..7ceeb36f666 100644 --- a/lld/lib/ReaderWriter/ELF/SectionChunks.h +++ b/lld/lib/ReaderWriter/ELF/SectionChunks.h @@ -378,7 +378,7 @@ void AtomSection<ELFT>::write(ELFWriter *writer, if (!definedAtom->occupiesDiskSpace()) return; // Copy raw content of atom to file buffer. - llvm::ArrayRef<uint8_t> content = definedAtom->rawContent(); + ArrayRef<uint8_t> content = definedAtom->rawContent(); uint64_t contentSize = content.size(); if (contentSize == 0) return; @@ -817,9 +817,9 @@ void SymbolTable<ELFT>::addSymbol(const Atom *atom, int32_t sectionIndex, else if (const AbsoluteAtom *aa = dyn_cast<const AbsoluteAtom>(atom)) addAbsoluteAtom(symbol, aa, addr); else if (isa<const SharedLibraryAtom>(atom)) - addSharedLibAtom(symbol, llvm::dyn_cast<SharedLibraryAtom>(atom)); + addSharedLibAtom(symbol, dyn_cast<SharedLibraryAtom>(atom)); else - addUndefinedAtom(symbol, llvm::dyn_cast<UndefinedAtom>(atom)); + addUndefinedAtom(symbol, dyn_cast<UndefinedAtom>(atom)); _symbolTable.push_back(SymbolEntry(atom, symbol, atomLayout)); this->_fsize += sizeof(Elf_Sym); diff --git a/lld/lib/ReaderWriter/ELF/SegmentChunks.h b/lld/lib/ReaderWriter/ELF/SegmentChunks.h index ef1de72c457..1afc6513068 100644 --- a/lld/lib/ReaderWriter/ELF/SegmentChunks.h +++ b/lld/lib/ReaderWriter/ELF/SegmentChunks.h @@ -548,7 +548,7 @@ template <class ELFT> void Segment<ELFT>::assignVirtualAddress(uint64_t &addr) { // Check if the segment is of type TLS // The sections that belong to the TLS segment have their // virtual addresses that are relative To TP - Section<ELFT> *currentSection = llvm::dyn_cast<Section<ELFT> >(section); + Section<ELFT> *currentSection = dyn_cast<Section<ELFT> >(section); if (currentSection) isTLSSegment = (currentSection->getSegmentType() == llvm::ELF::PT_TLS); diff --git a/lld/lib/ReaderWriter/LinkerScript.cpp b/lld/lib/ReaderWriter/LinkerScript.cpp index d5629f9fcf7..999018ea00b 100644 --- a/lld/lib/ReaderWriter/LinkerScript.cpp +++ b/lld/lib/ReaderWriter/LinkerScript.cpp @@ -16,7 +16,7 @@ namespace lld { namespace script { -void Token::dump(llvm::raw_ostream &os) const { +void Token::dump(raw_ostream &os) const { switch (_kind) { #define CASE(name) \ case Token::name: \ diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h index 8ed9f980ba0..b90370d2629 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h @@ -255,7 +255,7 @@ readYaml(std::unique_ptr<MemoryBuffer> &mb); /// Writes a yaml encoded mach-o files given an in-memory normalized view. error_code -writeYaml(const NormalizedFile &file, llvm::raw_ostream &out); +writeYaml(const NormalizedFile &file, raw_ostream &out); /// Takes in-memory normalized dylib or object and parses it into lld::File diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 932c48e5023..6dbafb24f9e 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -416,7 +416,7 @@ struct MappingTraits<Symbol> { // Custom mapping for VMProtect (e.g. "r-x"). template <> struct ScalarTraits<VMProtect> { - static void output(const VMProtect &value, void*, llvm::raw_ostream &out) { + static void output(const VMProtect &value, void*, raw_ostream &out) { out << ( (value & llvm::MachO::VM_PROT_READ) ? 'r' : '-'); out << ( (value & llvm::MachO::VM_PROT_WRITE) ? 'w' : '-'); out << ( (value & llvm::MachO::VM_PROT_EXECUTE) ? 'x' : '-'); @@ -641,7 +641,7 @@ readYaml(std::unique_ptr<MemoryBuffer> &mb) { /// Writes a yaml encoded mach-o files from an in-memory normalized view. error_code -writeYaml(const NormalizedFile &file, llvm::raw_ostream &out) { +writeYaml(const NormalizedFile &file, raw_ostream &out) { // YAML I/O is not const aware, so need to cast away ;-( NormalizedFile *f = const_cast<NormalizedFile*>(&file); diff --git a/lld/lib/ReaderWriter/Native/ReaderNative.cpp b/lld/lib/ReaderWriter/Native/ReaderNative.cpp index d839ba077d5..e614637faec 100644 --- a/lld/lib/ReaderWriter/Native/ReaderNative.cpp +++ b/lld/lib/ReaderWriter/Native/ReaderNative.cpp @@ -734,7 +734,7 @@ private: } // private constructor, only called by make() - File(const LinkingContext &context, std::unique_ptr<llvm::MemoryBuffer> mb, + File(const LinkingContext &context, std::unique_ptr<MemoryBuffer> mb, StringRef path) : lld::File(path, kindObject), _buffer(std::move(mb)), // Reader now takes ownership of buffer @@ -787,7 +787,7 @@ private: }; - std::unique_ptr<llvm::MemoryBuffer> _buffer; + std::unique_ptr<MemoryBuffer> _buffer; const NativeFileHeader* _header; AtomArray<DefinedAtom> _definedAtoms; AtomArray<UndefinedAtom> _undefinedAtoms; diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index cc4a5ea0a64..58baeb7b9fa 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -140,14 +140,14 @@ private: public: FileCOFF(const LinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> mb, error_code &ec) + std::unique_ptr<MemoryBuffer> mb, error_code &ec) : File(mb->getBufferIdentifier(), kindObject), _context(context) { - llvm::OwningPtr<llvm::object::Binary> bin; + OwningPtr<llvm::object::Binary> bin; ec = llvm::object::createBinary(mb.release(), bin); if (ec) return; - _obj.reset(llvm::dyn_cast<const llvm::object::COFFObjectFile>(bin.get())); + _obj.reset(dyn_cast<const llvm::object::COFFObjectFile>(bin.get())); if (!_obj) { ec = make_error_code(llvm::object::object_error::invalid_file_type); return; @@ -887,10 +887,10 @@ private: llvm::FileRemover coffFileRemover(*coffFilePath); // Read and parse the COFF - OwningPtr<llvm::MemoryBuffer> opmb; - if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(*coffFilePath, opmb)) + OwningPtr<MemoryBuffer> opmb; + if (error_code ec = MemoryBuffer::getFileOrSTDIN(*coffFilePath, opmb)) return ec; - std::unique_ptr<llvm::MemoryBuffer> newmb(opmb.take()); + std::unique_ptr<MemoryBuffer> newmb(opmb.take()); return parseCOFFFile(newmb, result); } diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp index 483a137582c..5228c649814 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp @@ -182,8 +182,8 @@ std::vector<uint8_t> FuncAtom::rawContent( class FileImportLibrary : public File { public: FileImportLibrary(const LinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> mb, - llvm::error_code &ec) + std::unique_ptr<MemoryBuffer> mb, + error_code &ec) : File(mb->getBufferIdentifier(), kindSharedLibrary), _context(context) { const char *buf = mb->getBufferStart(); const char *end = mb->getBufferEnd(); diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.h b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.h index f827cfe586d..1404e27fec3 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.h +++ b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.h @@ -24,9 +24,9 @@ class File; namespace coff { -llvm::error_code +error_code parseCOFFImportLibrary(const LinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> &mb, + std::unique_ptr<MemoryBuffer> &mb, std::vector<std::unique_ptr<File> > &result); } } diff --git a/lld/lib/ReaderWriter/ReaderLinkerScript.cpp b/lld/lib/ReaderWriter/ReaderLinkerScript.cpp index aab0d857422..b091ff9149b 100644 --- a/lld/lib/ReaderWriter/ReaderLinkerScript.cpp +++ b/lld/lib/ReaderWriter/ReaderLinkerScript.cpp @@ -21,7 +21,7 @@ class LinkerScriptFile : public File { public: static ErrorOr<std::unique_ptr<LinkerScriptFile> > create(const LinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> mb) { + std::unique_ptr<MemoryBuffer> mb) { std::unique_ptr<LinkerScriptFile> file( new LinkerScriptFile(context, std::move(mb))); file->_script = file->_parser.parse(); @@ -56,7 +56,7 @@ public: private: LinkerScriptFile(const LinkingContext &context, - std::unique_ptr<llvm::MemoryBuffer> mb) + std::unique_ptr<MemoryBuffer> mb) : File(mb->getBufferIdentifier(), kindLinkerScript), _context(context), _lexer(std::move(mb)), _parser(_lexer), _script(nullptr) {} @@ -83,11 +83,11 @@ error_code ReaderLinkerScript::parseFile( for (const auto &c : ls->_commands) { if (auto group = dyn_cast<lld::script::Group>(c)) for (const auto &path : group->getPaths()) { - OwningPtr<llvm::MemoryBuffer> opmb; + OwningPtr<MemoryBuffer> opmb; if (error_code ec = - llvm::MemoryBuffer::getFileOrSTDIN(path._path, opmb)) + MemoryBuffer::getFileOrSTDIN(path._path, opmb)) return ec; - std::unique_ptr<llvm::MemoryBuffer> eachMB(opmb.take()); + std::unique_ptr<MemoryBuffer> eachMB(opmb.take()); if (error_code ec = _context.getDefaultReader().parseFile(eachMB, result)) return ec; diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp index 7e5e1ab2094..8a7eb4c5296 100644 --- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -90,7 +90,7 @@ public: std::string storage; llvm::raw_string_ostream buffer(storage); buffer << llvm::format("L%03d", _unnamedCounter++); - llvm::StringRef newName = copyString(buffer.str()); + StringRef newName = copyString(buffer.str()); _refNames[target] = newName; DEBUG_WITH_TYPE("WriterYAML", llvm::dbgs() << "unnamed atom: creating ref-name: '" @@ -119,7 +119,7 @@ public: std::string Storage; llvm::raw_string_ostream buffer(Storage); buffer << atom.name() << llvm::format(".%03d", ++_collisionCount); - llvm::StringRef newName = copyString(buffer.str()); + StringRef newName = copyString(buffer.str()); _refNames[&atom] = newName; DEBUG_WITH_TYPE("WriterYAML", llvm::dbgs() << "name collsion: creating ref-name: '" @@ -132,7 +132,7 @@ public: std::string Storage2; llvm::raw_string_ostream buffer2(Storage2); buffer2 << prevAtom->name() << llvm::format(".%03d", ++_collisionCount); - llvm::StringRef newName2 = copyString(buffer2.str()); + StringRef newName2 = copyString(buffer2.str()); _refNames[prevAtom] = newName2; DEBUG_WITH_TYPE("WriterYAML", llvm::dbgs() << "name collsion: creating ref-name: '" @@ -153,7 +153,7 @@ public: bool hasRefName(const lld::Atom *atom) { return _refNames.count(atom); } - llvm::StringRef refName(const lld::Atom *atom) { + StringRef refName(const lld::Atom *atom) { return _refNames.find(atom)->second; } @@ -163,13 +163,13 @@ private: // Allocate a new copy of this string and keep track of allocations // in _stringCopies, so they can be freed when RefNameBuilder is destroyed. - llvm::StringRef copyString(llvm::StringRef str) { + StringRef copyString(StringRef str) { // We want _stringCopies to own the string memory so it is deallocated // when the File object is destroyed. But we need a StringRef that // points into that memory. std::unique_ptr<char[]> s(new char[str.size()]); memcpy(s.get(), str.data(), str.size()); - llvm::StringRef r = llvm::StringRef(s.get(), str.size()); + StringRef r = StringRef(s.get(), str.size()); _stringCopies.push_back(std::move(s)); return r; } @@ -187,12 +187,12 @@ class RefNameResolver { public: RefNameResolver(const lld::File *file, IO &io); - const lld::Atom *lookup(llvm::StringRef name) const { + const lld::Atom *lookup(StringRef name) const { NameToAtom::const_iterator pos = _nameMap.find(name); if (pos != _nameMap.end()) { return pos->second; } else { - _io.setError(llvm::Twine("no such atom name: ") + name); + _io.setError(Twine("no such atom name: ") + name); return nullptr; } } @@ -200,9 +200,9 @@ public: private: typedef llvm::StringMap<const lld::Atom *> NameToAtom; - void add(llvm::StringRef name, const lld::Atom *atom) { + void add(StringRef name, const lld::Atom *atom) { if (_nameMap.count(name)) { - _io.setError(llvm::Twine("duplicate atom name: ") + name); + _io.setError(Twine("duplicate atom name: ") + name); } else { _nameMap[name] = atom; } @@ -248,7 +248,7 @@ enum FileKinds { struct ArchMember { FileKinds _kind; - llvm::StringRef _name; + StringRef _name; const lld::File *_content; }; @@ -276,7 +276,7 @@ namespace yaml { // This is a custom formatter for RefKind template <> struct ScalarTraits<RefKind> { - static void output(const RefKind &value, void *ctxt, llvm::raw_ostream &out) { + static void output(const RefKind &value, void *ctxt, raw_ostream &out) { assert(ctxt != nullptr); ContextInfo *info = reinterpret_cast<ContextInfo *>(ctxt); switch (value) { @@ -486,7 +486,7 @@ struct ScalarEnumerationTraits<lld::SharedLibraryAtom::Type> { /// 7 mod 2^4 # 16-byte aligned plus 7 bytes template <> struct ScalarTraits<lld::DefinedAtom::Alignment> { static void output(const lld::DefinedAtom::Alignment &value, void *ctxt, - llvm::raw_ostream &out) { + raw_ostream &out) { if (value.modulus == 0) { out << llvm::format("2^%d", value.powerOf2); } else { @@ -555,12 +555,12 @@ template <typename T> struct SequenceTraits<AtomList<T> > { // Used to allow DefinedAtom content bytes to be a flow sequence of // two-digit hex numbers without the leading 0x (e.g. FF, 04, 0A) template <> struct ScalarTraits<ImplicitHex8> { - static void output(const ImplicitHex8 &val, void *, llvm::raw_ostream &out) { + static void output(const ImplicitHex8 &val, void *, raw_ostream &out) { uint8_t num = val; out << llvm::format("%02X", num); } - static llvm::StringRef input(llvm::StringRef str, void *, ImplicitHex8 &val) { + static StringRef input(StringRef str, void *, ImplicitHex8 &val) { unsigned long long n; if (getAsUnsignedInteger(str, 16, n)) return "invalid two-digit-hex number"; @@ -681,7 +681,7 @@ template <> struct MappingTraits<const lld::File *> { // points into that memory. std::unique_ptr<char[]> s(new char[str.size()]); memcpy(s.get(), str.data(), str.size()); - llvm::StringRef r = llvm::StringRef(s.get(), str.size()); + StringRef r = StringRef(s.get(), str.size()); _stringCopies.push_back(std::move(s)); return r; } @@ -1211,11 +1211,11 @@ inline void MappingTraits<const lld::Reference *>::NormalizedReference::bind( _target = resolver.lookup(_targetName); } -inline llvm::StringRef +inline StringRef MappingTraits<const lld::Reference *>::NormalizedReference::targetName( IO &io, const lld::Reference *ref) { if (ref->target() == nullptr) - return llvm::StringRef(); + return StringRef(); ContextInfo *info = reinterpret_cast<ContextInfo *>(io.getContext()); assert(info != nullptr); typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile; |

