From bb579542419ca790de86c31339e2c652ed7f8d11 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 15 Jul 2016 01:12:24 +0000 Subject: [PATCH] COFF: Update error messages so that they start with lowercase letters. llvm-svn: 275513 --- lld/COFF/Chunks.cpp | 6 +++--- lld/COFF/Driver.cpp | 6 +++--- lld/COFF/DriverUtils.cpp | 20 ++++++++++---------- lld/COFF/InputFiles.cpp | 14 +++++++------- lld/COFF/Librarian.cpp | 2 +- lld/COFF/SymbolTable.cpp | 2 +- lld/COFF/Symbols.cpp | 2 +- lld/COFF/Writer.cpp | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index 067a556..1c1b1817 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -61,7 +61,7 @@ void SectionChunk::applyRelX64(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_AMD64_SECTION: add16(Off, Sym->getSectionIndex()); break; case IMAGE_REL_AMD64_SECREL: add32(Off, Sym->getSecrel()); break; default: - fatal("Unsupported relocation type"); + fatal("unsupported relocation type"); } } @@ -76,7 +76,7 @@ void SectionChunk::applyRelX86(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_I386_SECTION: add16(Off, Sym->getSectionIndex()); break; case IMAGE_REL_I386_SECREL: add32(Off, Sym->getSecrel()); break; default: - fatal("Unsupported relocation type"); + fatal("unsupported relocation type"); } } @@ -120,7 +120,7 @@ void SectionChunk::applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym, case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break; case IMAGE_REL_ARM_BLX23T: applyBranch24T(Off, S - P - 4); break; default: - fatal("Unsupported relocation type"); + fatal("unsupported relocation type"); } } diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 469f0d3..bb6a60e 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -62,7 +62,7 @@ static std::string getOutputPath(StringRef Path) { // Newly created memory buffers are owned by this driver. MemoryBufferRef LinkerDriver::openFile(StringRef Path) { std::unique_ptr MB = - check(MemoryBuffer::getFile(Path), "Could not open " + Path); + check(MemoryBuffer::getFile(Path), "could not open " + Path); MemoryBufferRef MBRef = MB->getMemBufferRef(); OwningMBs.push_back(std::move(MB)); // take ownership return MBRef; @@ -274,7 +274,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { } if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end()) - fatal("no input files."); + fatal("no input files"); // Construct search path list. SearchPaths.push_back(""); @@ -683,7 +683,7 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { std::error_code EC; llvm::raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text); if (EC) - fatal(EC, "Could not create the symbol map"); + fatal(EC, "could not create the symbol map"); Symtab.printMap(Out); } // Call exit to avoid calling destructors. diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index 334c740..5d7dc2b 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -59,7 +59,7 @@ public: for (const char *S : Args) if (S) llvm::errs() << S << " "; - fatal("failed"); + fatal("ExecuteAndWait failed"); } } @@ -222,16 +222,16 @@ void parseManifest(StringRef Arg) { return; } if (!Arg.startswith_lower("embed")) - fatal("Invalid option " + Arg); + fatal("invalid option " + Arg); Config->Manifest = Configuration::Embed; Arg = Arg.substr(strlen("embed")); if (Arg.empty()) return; if (!Arg.startswith_lower(",id=")) - fatal("Invalid option " + Arg); + fatal("invalid option " + Arg); Arg = Arg.substr(strlen(",id=")); if (Arg.getAsInteger(0, Config->ManifestID)) - fatal("Invalid option " + Arg); + fatal("invalid option " + Arg); } // Parses a string in the form of "level=|uiAccess=|NO". @@ -255,7 +255,7 @@ void parseManifestUAC(StringRef Arg) { std::tie(Config->ManifestUIAccess, Arg) = Arg.split(" "); continue; } - fatal("Invalid option " + Arg); + fatal("invalid option " + Arg); } } @@ -321,7 +321,7 @@ static std::string createDefaultXml() { static std::string readFile(StringRef Path) { std::unique_ptr MB = - check(MemoryBuffer::getFile(Path), "Could not open " + Path); + check(MemoryBuffer::getFile(Path), "could not open " + Path); std::unique_ptr Buf(std::move(MB)); return Buf->getBuffer(); } @@ -389,7 +389,7 @@ std::unique_ptr createManifestRes() { E.add("/nologo"); E.add(RCPath.str()); E.run(); - return check(MemoryBuffer::getFile(ResPath), "Could not open " + ResPath); + return check(MemoryBuffer::getFile(ResPath), "could not open " + ResPath); } void createSideBySideManifest() { @@ -556,8 +556,8 @@ std::unique_ptr convertResToCOFF(const std::vector &MBs) { // Create an output file path. SmallString<128> Path; - if (llvm::sys::fs::createTemporaryFile("resource", "obj", Path)) - fatal("Could not create temporary file"); + if (auto EC = llvm::sys::fs::createTemporaryFile("resource", "obj", Path)) + fatal(EC, "could not create temporary file"); // Execute cvtres.exe. Executor E("cvtres.exe"); @@ -568,7 +568,7 @@ convertResToCOFF(const std::vector &MBs) { for (MemoryBufferRef MB : MBs) E.add(MB.getBufferIdentifier()); E.run(); - return check(MemoryBuffer::getFile(Path), "Could not open " + Path); + return check(MemoryBuffer::getFile(Path), "could not open " + Path); } // Create OptTable diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 54aac74..ff26826 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -63,7 +63,7 @@ std::string InputFile::getShortName() { void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. - File = check(Archive::create(MB), "Failed to parse static library"); + File = check(Archive::create(MB), "failed to parse static library"); // Allocate a buffer for Lazy objects. size_t NumSyms = File->getNumberOfSymbols(); @@ -80,7 +80,7 @@ void ArchiveFile::parse() { for (auto &Child : File->children(Err)) Seen[Child.getChildOffset()].clear(); if (Err) - fatal(Err, "Failed to parse static library"); + fatal(Err, "failed to parse static library"); } // Returns a buffer pointing to a member file containing a given symbol. @@ -88,26 +88,26 @@ void ArchiveFile::parse() { MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) { const Archive::Child &C = check(Sym->getMember(), - "Could not get the member for symbol " + Sym->getName()); + "could not get the member for symbol " + Sym->getName()); // Return an empty buffer if we have already returned the same buffer. if (Seen[C.getChildOffset()].test_and_set()) return MemoryBufferRef(); return check(C.getMemoryBufferRef(), - "Could not get the buffer for the member defining symbol " + + "could not get the buffer for the member defining symbol " + Sym->getName()); } void ObjectFile::parse() { // Parse a memory buffer as a COFF file. std::unique_ptr Bin = - check(createBinary(MB), "Failed to parse object file"); + check(createBinary(MB), "failed to parse object file"); if (auto *Obj = dyn_cast(Bin.get())) { Bin.release(); COFFObj.reset(Obj); } else { - fatal(getName() + " is not a COFF file."); + fatal(getName() + " is not a COFF file"); } // Read section and symbol tables. @@ -326,7 +326,7 @@ void BitcodeFile::parse() { Context.enableDebugTypeODRUniquing(); ErrorOr> ModOrErr = LTOModule::createFromBuffer( Context, MB.getBufferStart(), MB.getBufferSize(), llvm::TargetOptions()); - M = check(std::move(ModOrErr), "Could not create lto module"); + M = check(std::move(ModOrErr), "could not create LTO module"); llvm::StringSaver Saver(Alloc); for (unsigned I = 0, E = M->getSymbolCount(); I != E; ++I) { diff --git a/lld/COFF/Librarian.cpp b/lld/COFF/Librarian.cpp index dcd2750..25fb4a8 100644 --- a/lld/COFF/Librarian.cpp +++ b/lld/COFF/Librarian.cpp @@ -485,5 +485,5 @@ void lld::coff::writeImportLibrary() { writeArchive(Path, Members, /*WriteSymtab*/ true, object::Archive::K_GNU, /*Deterministic*/ true, /*Thin*/ false); if (auto EC = Result.second) - fatal(EC, Twine("Failed to write ") + Path); + fatal(EC, "failed to write " + Path); } diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index ef4559b..df9da4c 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -164,7 +164,7 @@ void SymbolTable::reportRemainingUndefines(bool Resolve) { llvm::errs() << File->getShortName() << ": undefined symbol: " << Sym->getName() << "\n"; if (!Config->Force) - fatal("Link failed"); + fatal("link failed"); } void SymbolTable::addLazy(Lazy *New, std::vector *Accum) { diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp index c725688..6e2db66 100644 --- a/lld/COFF/Symbols.cpp +++ b/lld/COFF/Symbols.cpp @@ -199,7 +199,7 @@ std::unique_ptr Lazy::getMember() { else if (Magic == file_magic::bitcode) Obj.reset(new BitcodeFile(MBRef)); else - fatal(File->getName() + ": unknown file type"); + fatal("unknown file type: " + File->getName()); Obj->setParentName(File->getName()); return Obj; diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index f970b51..d8077df9 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -240,7 +240,7 @@ void Writer::run() { writeSections(); sortExceptionTable(); if (auto EC = Buffer->commit()) - fatal(EC, "Failed to write the output file"); + fatal(EC, "failed to write the output file"); } static StringRef getOutputSection(StringRef Name) { -- 2.7.4