From 8fe1767cddc8088cfa82bd387dedb58de9122f02 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 8 Dec 2016 20:50:47 +0000 Subject: [PATCH] Remove unnecessary `llvm::`. llvm-svn: 289102 --- lld/COFF/Chunks.cpp | 2 +- lld/COFF/Driver.cpp | 44 ++++++++++++++++++++++---------------------- lld/COFF/DriverUtils.cpp | 43 +++++++++++++++++++++---------------------- lld/COFF/InputFiles.cpp | 6 +++--- lld/COFF/Librarian.cpp | 2 +- lld/COFF/SymbolTable.cpp | 17 ++++++++--------- lld/COFF/Writer.cpp | 6 +++--- 7 files changed, 59 insertions(+), 61 deletions(-) diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index d8d2ffa..dc50df7 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -226,7 +226,7 @@ void SectionChunk::printDiscardedMessage() const { // Removed by dead-stripping. If it's removed by ICF, ICF already // printed out the name, so don't repeat that here. if (Sym && this == Repl) - llvm::outs() << "Discarded " << Sym->getName() << "\n"; + outs() << "Discarded " << Sym->getName() << "\n"; } StringRef SectionChunk::getDebugName() { diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index ba3f36a..c9d0249 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -43,7 +43,7 @@ namespace coff { Configuration *Config; LinkerDriver *Driver; -bool link(llvm::ArrayRef Args) { +bool link(ArrayRef Args) { Config = make(); Driver = make(); Driver->link(Args); @@ -94,7 +94,7 @@ static bool isDecorated(StringRef Sym) { // Parses .drectve section contents and returns a list of files // specified by /defaultlib. void LinkerDriver::parseDirectives(StringRef S) { - llvm::opt::InputArgList Args = Parser.parse(S); + opt::InputArgList Args = Parser.parse(S); for (auto *Arg : Args) { switch (Arg->getOption().getID()) { @@ -148,12 +148,12 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) { bool HasExt = (Filename.find('.') != StringRef::npos); for (StringRef Dir : SearchPaths) { SmallString<128> Path = Dir; - llvm::sys::path::append(Path, Filename); - if (llvm::sys::fs::exists(Path.str())) + sys::path::append(Path, Filename); + if (sys::fs::exists(Path.str())) return Alloc.save(Path.str()); if (!HasExt) { Path.append(".obj"); - if (llvm::sys::fs::exists(Path.str())) + if (sys::fs::exists(Path.str())) return Alloc.save(Path.str()); } } @@ -254,7 +254,7 @@ static uint64_t getDefaultImageBase() { return Config->DLL ? 0x10000000 : 0x400000; } -static std::string createResponseFile(const llvm::opt::InputArgList &Args, +static std::string createResponseFile(const opt::InputArgList &Args, ArrayRef MBs, ArrayRef SearchPaths) { SmallString<0> Data; @@ -285,7 +285,7 @@ static std::string createResponseFile(const llvm::opt::InputArgList &Args, return Data.str(); } -static unsigned getDefaultDebugType(const llvm::opt::InputArgList &Args) { +static unsigned getDefaultDebugType(const opt::InputArgList &Args) { unsigned DebugTypes = static_cast(DebugType::CV); if (Args.hasArg(OPT_driver)) DebugTypes |= static_cast(DebugType::PData); @@ -295,7 +295,7 @@ static unsigned getDefaultDebugType(const llvm::opt::InputArgList &Args) { } static unsigned parseDebugType(StringRef Arg) { - llvm::SmallVector Types; + SmallVector Types; Arg.split(Types, ',', /*KeepEmpty=*/false); unsigned DebugTypes = static_cast(DebugType::None); @@ -307,7 +307,7 @@ static unsigned parseDebugType(StringRef Arg) { return DebugTypes; } -void LinkerDriver::link(llvm::ArrayRef ArgsArr) { +void LinkerDriver::link(ArrayRef ArgsArr) { // If the first command line argument is "/lib", link.exe acts like lib.exe. // We call our own implementation of lib.exe that understands bitcode files. if (ArgsArr.size() > 1 && StringRef(ArgsArr[1]).equals_lower("/lib")) { @@ -317,15 +317,15 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { } // Needed for LTO. - llvm::InitializeAllTargetInfos(); - llvm::InitializeAllTargets(); - llvm::InitializeAllTargetMCs(); - llvm::InitializeAllAsmParsers(); - llvm::InitializeAllAsmPrinters(); - llvm::InitializeAllDisassemblers(); + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + InitializeAllAsmParsers(); + InitializeAllAsmPrinters(); + InitializeAllDisassemblers(); // Parse command line options. - llvm::opt::InputArgList Args = Parser.parseLINK(ArgsArr.slice(1)); + opt::InputArgList Args = Parser.parseLINK(ArgsArr.slice(1)); // Handle /help if (Args.hasArg(OPT_help)) { @@ -335,13 +335,13 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { if (auto *Arg = Args.getLastArg(OPT_linkrepro)) { SmallString<64> Path = StringRef(Arg->getValue()); - llvm::sys::path::append(Path, "repro"); + sys::path::append(Path, "repro"); ErrorOr F = CpioFile::create(Path); if (F) Cpio.reset(*F); else - llvm::errs() << "/linkrepro: failed to open " << Path - << ".cpio: " << F.getError().message() << '\n'; + errs() << "/linkrepro: failed to open " << Path + << ".cpio: " << F.getError().message() << '\n'; } if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end()) @@ -584,7 +584,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { " conflicts with " + machineToStr(Config->Machine)); } if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) { - llvm::errs() << "warning: /machine is not specified. x64 is assumed.\n"; + errs() << "warning: /machine is not specified. x64 is assumed.\n"; Config->Machine = AMD64; } @@ -625,7 +625,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { fatal("entry point must be defined"); Config->Entry = addUndefined(S); if (Config->Verbose) - llvm::outs() << "Entry name inferred: " << S << "\n"; + outs() << "Entry name inferred: " << S << "\n"; } // Handle /export @@ -765,7 +765,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { // to help debugging. if (auto *Arg = Args.getLastArg(OPT_lldmap)) { std::error_code EC; - llvm::raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text); + raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text); if (EC) fatal(EC, "could not create the symbol map"); Symtab.printMap(Out); diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index b4b8ee9..864a7e6 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -49,23 +49,23 @@ public: void add(const char *S) { Args.push_back(Saver.save(S).data()); } void run() { - ErrorOr ExeOrErr = llvm::sys::findProgramByName(Prog); + ErrorOr ExeOrErr = sys::findProgramByName(Prog); if (auto EC = ExeOrErr.getError()) fatal(EC, "unable to find " + Prog + " in PATH: "); const char *Exe = Saver.save(*ExeOrErr).data(); Args.insert(Args.begin(), Exe); Args.push_back(nullptr); - if (llvm::sys::ExecuteAndWait(Args[0], Args.data()) != 0) { + if (sys::ExecuteAndWait(Args[0], Args.data()) != 0) { for (const char *S : Args) if (S) - llvm::errs() << S << " "; + errs() << S << " "; fatal("ExecuteAndWait failed"); } } private: - llvm::BumpPtrAllocator Alloc; - llvm::StringSaver Saver; + BumpPtrAllocator Alloc; + StringSaver Saver; StringRef Prog; std::vector Args; }; @@ -166,8 +166,8 @@ void parseMerge(StringRef S) { if (!Inserted) { StringRef Existing = Pair.first->second; if (Existing != To) - llvm::errs() << "warning: " << S << ": already merged into " - << Existing << "\n"; + errs() << "warning: " << S << ": already merged into " << Existing + << "\n"; } } @@ -322,7 +322,7 @@ TemporaryFile createDefaultXml() { // Open the temporary file for writing. std::error_code EC; - llvm::raw_fd_ostream OS(File.Path, EC, sys::fs::F_Text); + raw_fd_ostream OS(File.Path, EC, sys::fs::F_Text); if (EC) fatal(EC, "failed to open " + File.Path); @@ -389,7 +389,7 @@ std::unique_ptr createManifestRes() { // Open the temporary file for writing. std::error_code EC; - llvm::raw_fd_ostream Out(RCFile.Path, EC, sys::fs::F_Text); + raw_fd_ostream Out(RCFile.Path, EC, sys::fs::F_Text); if (EC) fatal(EC, "failed to open " + RCFile.Path); @@ -421,7 +421,7 @@ void createSideBySideManifest() { if (Path == "") Path = Config->OutputFile + ".manifest"; std::error_code EC; - llvm::raw_fd_ostream Out(Path, EC, llvm::sys::fs::F_Text); + raw_fd_ostream Out(Path, EC, sys::fs::F_Text); if (EC) fatal(EC, "failed to create manifest"); Out << createManifestXml(); @@ -539,7 +539,7 @@ void fixupExports() { Export *Existing = Pair.first->second; if (E == *Existing || E.Name != Existing->Name) continue; - llvm::errs() << "warning: duplicate /export option: " << E.Name << "\n"; + errs() << "warning: duplicate /export option: " << E.Name << "\n"; } Config->Exports = std::move(V); @@ -601,7 +601,7 @@ convertResToCOFF(const std::vector &MBs) { TemporaryFile& ResFile = ResFiles.back(); // Write the content of the resource in a temporary file std::error_code EC; - llvm::raw_fd_ostream OS(ResFile.Path, EC, sys::fs::F_None); + raw_fd_ostream OS(ResFile.Path, EC, sys::fs::F_None); if (EC) fatal(EC, "failed to open " + ResFile.Path); OS << MB.getBuffer(); @@ -638,7 +638,7 @@ public: }; // Parses a given list of options. -llvm::opt::InputArgList ArgParser::parse(ArrayRef ArgsArr) { +opt::InputArgList ArgParser::parse(ArrayRef ArgsArr) { // First, replace respnose files (@-style options). std::vector Argv = replaceResponseFiles(ArgsArr); @@ -646,28 +646,27 @@ llvm::opt::InputArgList ArgParser::parse(ArrayRef ArgsArr) { COFFOptTable Table; unsigned MissingIndex; unsigned MissingCount; - llvm::opt::InputArgList Args = - Table.ParseArgs(Argv, MissingIndex, MissingCount); + opt::InputArgList Args = Table.ParseArgs(Argv, MissingIndex, MissingCount); // Print the real command line if response files are expanded. if (Args.hasArg(OPT_verbose) && ArgsArr.size() != Argv.size()) { - llvm::outs() << "Command line:"; + outs() << "Command line:"; for (const char *S : Argv) - llvm::outs() << " " << S; - llvm::outs() << "\n"; + outs() << " " << S; + outs() << "\n"; } if (MissingCount) fatal(Twine(Args.getArgString(MissingIndex)) + ": missing argument"); for (auto *Arg : Args.filtered(OPT_UNKNOWN)) - llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n"; + errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n"; return Args; } // link.exe has an interesting feature. If LINK environment exists, // its contents are handled as a command line string. So you can pass // extra arguments using the environment variable. -llvm::opt::InputArgList ArgParser::parseLINK(ArrayRef Args) { +opt::InputArgList ArgParser::parseLINK(ArrayRef Args) { // Concatenate LINK env and command line arguments, and then parse them. Optional Env = Process::GetEnv("LINK"); if (!Env) @@ -680,7 +679,7 @@ llvm::opt::InputArgList ArgParser::parseLINK(ArrayRef Args) { std::vector ArgParser::tokenize(StringRef S) { SmallVector Tokens; StringSaver Saver(AllocAux); - llvm::cl::TokenizeWindowsCommandLine(S, Saver, Tokens); + cl::TokenizeWindowsCommandLine(S, Saver, Tokens); return std::vector(Tokens.begin(), Tokens.end()); } @@ -696,7 +695,7 @@ ArgParser::replaceResponseFiles(std::vector Argv) { void printHelp(const char *Argv0) { COFFOptTable Table; - Table.PrintHelp(llvm::outs(), Argv0, "LLVM Linker", false); + Table.PrintHelp(outs(), Argv0, "LLVM Linker", false); } } // namespace coff diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index a00d762..087d7e2 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -44,7 +44,7 @@ namespace lld { namespace coff { int InputFile::NextIndex = 0; -llvm::LLVMContext BitcodeFile::Context; +LLVMContext BitcodeFile::Context; std::mutex BitcodeFile::Mu; ArchiveFile::ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {} @@ -167,7 +167,7 @@ void ObjectFile::initializeSymbols() { uint32_t NumSymbols = COFFObj->getNumberOfSymbols(); SymbolBodies.reserve(NumSymbols); SparseSymbolBodies.resize(NumSymbols); - llvm::SmallVector, 8> WeakAliases; + SmallVector, 8> WeakAliases; int32_t LastSectionNumber = 0; for (uint32_t I = 0; I < NumSymbols; ++I) { // Get a COFFSymbolRef object. @@ -339,7 +339,7 @@ void BitcodeFile::parse() { Context, MB.getBufferStart(), MB.getBufferSize(), llvm::TargetOptions()); M = check(std::move(ModOrErr), "could not create LTO module"); - llvm::StringSaver Saver(Alloc); + StringSaver Saver(Alloc); for (unsigned I = 0, E = M->getSymbolCount(); I != E; ++I) { lto_symbol_attributes Attrs = M->getSymbolAttributes(I); if ((Attrs & LTO_SYMBOL_SCOPE_MASK) == LTO_SYMBOL_SCOPE_INTERNAL) diff --git a/lld/COFF/Librarian.cpp b/lld/COFF/Librarian.cpp index 75e94e6..4c597fa 100644 --- a/lld/COFF/Librarian.cpp +++ b/lld/COFF/Librarian.cpp @@ -463,7 +463,7 @@ void lld::coff::writeImportLibrary() { std::vector Members; std::string Path = getImplibPath(); - std::string DLLName = llvm::sys::path::filename(Config->OutputFile); + std::string DLLName = sys::path::filename(Config->OutputFile); ObjectFactory OF(DLLName); std::vector ImportDescriptor; diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index b90a5ae..e80442c 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -71,7 +71,7 @@ void SymbolTable::readArchives() { for (std::future &Future : ArchiveQueue) { ArchiveFile *File = Future.get(); if (Config->Verbose) - llvm::outs() << "Reading " << toString(File) << "\n"; + outs() << "Reading " << toString(File) << "\n"; for (Lazy &Sym : File->getLazySymbols()) addLazy(&Sym, &LazySyms); } @@ -92,7 +92,7 @@ void SymbolTable::readObjects() { for (size_t I = 0; I < ObjectQueue.size(); ++I) { InputFile *File = ObjectQueue[I].get(); if (Config->Verbose) - llvm::outs() << "Reading " << toString(File) << "\n"; + outs() << "Reading " << toString(File) << "\n"; // Adding symbols may add more files to ObjectQueue // (but not to ArchiveQueue). for (SymbolBody *Sym : File->getSymbols()) @@ -102,7 +102,7 @@ void SymbolTable::readObjects() { if (!S.empty()) { Directives.push_back(S); if (Config->Verbose) - llvm::outs() << "Directives: " << toString(File) << ": " << S << "\n"; + outs() << "Directives: " << toString(File) << ": " << S << "\n"; } } ObjectQueue.clear(); @@ -118,7 +118,7 @@ bool SymbolTable::queueEmpty() { } void SymbolTable::reportRemainingUndefines(bool Resolve) { - llvm::SmallPtrSet Undefs; + SmallPtrSet Undefs; for (auto &I : Symtab) { Symbol *Sym = I.second; auto *Undef = dyn_cast(Sym->Body); @@ -155,13 +155,13 @@ void SymbolTable::reportRemainingUndefines(bool Resolve) { return; for (Undefined *U : Config->GCRoot) if (Undefs.count(U->repl())) - llvm::errs() << ": undefined symbol: " << U->getName() << "\n"; + errs() << ": undefined symbol: " << U->getName() << "\n"; for (InputFile *File : Files) if (!isa(File)) for (SymbolBody *Sym : File->getSymbols()) if (Undefs.count(Sym->repl())) - llvm::errs() << toString(File) - << ": undefined symbol: " << Sym->getName() << "\n"; + errs() << toString(File) << ": undefined symbol: " << Sym->getName() + << "\n"; if (!Config->Force) fatal("link failed"); } @@ -237,8 +237,7 @@ void SymbolTable::addMemberFile(Lazy *Body) { if (!File) return; if (Config->Verbose) - llvm::outs() << "Loaded " << toString(File) << " for " << Body->getName() - << "\n"; + outs() << "Loaded " << toString(File) << " for " << Body->getName() << "\n"; addFile(File); } diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 7dcd902..72fc522 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -134,9 +134,9 @@ private: std::map> binImports(); SymbolTable *Symtab; - std::unique_ptr Buffer; - llvm::SpecificBumpPtrAllocator CAlloc; - llvm::SpecificBumpPtrAllocator BAlloc; + std::unique_ptr Buffer; + SpecificBumpPtrAllocator CAlloc; + SpecificBumpPtrAllocator BAlloc; std::vector OutputSections; std::vector Strtab; std::vector OutputSymtab; -- 2.7.4