[lld] r275513 - COFF: Update error messages so that they start with lowercase letters.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 18:12:25 PDT 2016


Author: ruiu
Date: Thu Jul 14 20:12:24 2016
New Revision: 275513

URL: http://llvm.org/viewvc/llvm-project?rev=275513&view=rev
Log:
COFF: Update error messages so that they start with lowercase letters.

Modified:
    lld/trunk/COFF/Chunks.cpp
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/DriverUtils.cpp
    lld/trunk/COFF/InputFiles.cpp
    lld/trunk/COFF/Librarian.cpp
    lld/trunk/COFF/SymbolTable.cpp
    lld/trunk/COFF/Symbols.cpp
    lld/trunk/COFF/Writer.cpp

Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Thu Jul 14 20:12:24 2016
@@ -61,7 +61,7 @@ void SectionChunk::applyRelX64(uint8_t *
   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 *
   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 *
   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");
   }
 }
 

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Jul 14 20:12:24 2016
@@ -62,7 +62,7 @@ static std::string getOutputPath(StringR
 // Newly created memory buffers are owned by this driver.
 MemoryBufferRef LinkerDriver::openFile(StringRef Path) {
   std::unique_ptr<MemoryBuffer> 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<c
   }
 
   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<c
     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.

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Thu Jul 14 20:12:24 2016
@@ -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=<string>|uiAccess=<string>|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<MemoryBuffer> MB =
-      check(MemoryBuffer::getFile(Path), "Could not open " + Path);
+      check(MemoryBuffer::getFile(Path), "could not open " + Path);
   std::unique_ptr<MemoryBuffer> Buf(std::move(MB));
   return Buf->getBuffer();
 }
@@ -389,7 +389,7 @@ std::unique_ptr<MemoryBuffer> createMani
   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<MemoryBuffer>
 convertResToCOFF(const std::vector<MemoryBufferRef> &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<Memor
   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

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Thu Jul 14 20:12:24 2016
@@ -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<Binary> Bin =
-      check(createBinary(MB), "Failed to parse object file");
+      check(createBinary(MB), "failed to parse object file");
 
   if (auto *Obj = dyn_cast<COFFObjectFile>(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<std::unique_ptr<LTOModule>> 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) {

Modified: lld/trunk/COFF/Librarian.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Librarian.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/Librarian.cpp (original)
+++ lld/trunk/COFF/Librarian.cpp Thu Jul 14 20:12:24 2016
@@ -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);
 }

Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Thu Jul 14 20:12:24 2016
@@ -164,7 +164,7 @@ void SymbolTable::reportRemainingUndefin
           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<Symbol *> *Accum) {

Modified: lld/trunk/COFF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.cpp (original)
+++ lld/trunk/COFF/Symbols.cpp Thu Jul 14 20:12:24 2016
@@ -199,7 +199,7 @@ std::unique_ptr<InputFile> Lazy::getMemb
   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;

Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=275513&r1=275512&r2=275513&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Thu Jul 14 20:12:24 2016
@@ -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) {




More information about the llvm-commits mailing list