[llvm-objcopy] Tidy up error messages

This patch brings various error messages into line with each other, by
removing trailing full stops, and making the first letter lower-case.
This addresses https://bugs.llvm.org/show_bug.cgi?id=40859.

Reviewed by: jhenderson, rupprecht, jakehehrlich

Differential Revision: https://reviews.llvm.org/D62072

Patch by Alex Brachet

llvm-svn: 361384
diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
index 1f5509e..4ae4685 100644
--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
@@ -143,7 +143,7 @@
         reportError(Config.OutputFilename,
                     createStringError(llvm::errc::invalid_argument,
                                       "not stripping symbol '%s' because it is "
-                                      "named in a relocation.",
+                                      "named in a relocation",
                                       Sym.Name.str().c_str()));
       return true;
     }
@@ -189,7 +189,7 @@
       Config.DiscardMode == DiscardType::Locals ||
       !Config.SymbolsToAdd.empty() || Config.EntryExpr) {
     return createStringError(llvm::errc::invalid_argument,
-                             "Option not supported by llvm-objcopy for COFF");
+                             "option not supported by llvm-objcopy for COFF");
   }
 
   return Error::success();
diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
index 0ad5a05..b07532c 100644
--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
@@ -53,7 +53,7 @@
       auto It = SymbolMap.find(R.Target);
       if (It == SymbolMap.end())
         return createStringError(object_error::invalid_symbol_index,
-                                 "Relocation target %zu not found", R.Target);
+                                 "relocation target %zu not found", R.Target);
       It->second->Referenced = true;
     }
   }
diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
index a9511c5..1f0ec9f 100644
--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
@@ -81,7 +81,7 @@
       return NameOrErr.takeError();
     if (Sec->hasExtendedRelocations())
       return createStringError(object_error::parse_failed,
-                               "Extended relocations not supported yet");
+                               "extended relocations not supported yet");
   }
   Obj.addSections(Sections);
   return Error::success();
@@ -135,7 +135,7 @@
       Sym.TargetSectionId = Sections[SymRef.getSectionNumber() - 1].UniqueId;
     else
       return createStringError(object_error::parse_failed,
-                               "Section number out of range");
+                               "section number out of range");
     // For section definitions, check if it is comdat associative, and if
     // it is, find the target section unique id.
     const coff_aux_section_definition *SD = SymRef.getSectionDefinition();
@@ -144,7 +144,7 @@
       int32_t Index = SD->getNumber(IsBigObj);
       if (Index <= 0 || static_cast<uint32_t>(Index - 1) >= Sections.size())
         return createStringError(object_error::parse_failed,
-                                 "Unexpected associative section index");
+                                 "unexpected associative section index");
       Sym.AssociativeComdatTargetSectionId = Sections[Index - 1].UniqueId;
     } else if (WE) {
       // This is a raw symbol index for now, but store it in the Symbol
@@ -171,11 +171,11 @@
     if (Sym.WeakTargetSymbolId) {
       if (*Sym.WeakTargetSymbolId >= RawSymbolTable.size())
         return createStringError(object_error::parse_failed,
-                                 "Weak external reference out of range");
+                                 "weak external reference out of range");
       const Symbol *Target = RawSymbolTable[*Sym.WeakTargetSymbolId];
       if (Target == nullptr)
         return createStringError(object_error::parse_failed,
-                                 "Invalid SymbolTableIndex");
+                                 "invalid SymbolTableIndex");
       Sym.WeakTargetSymbolId = Target->UniqueId;
     }
   }
@@ -187,7 +187,7 @@
       const Symbol *Sym = RawSymbolTable[R.Reloc.SymbolTableIndex];
       if (Sym == nullptr)
         return createStringError(object_error::parse_failed,
-                                 "Invalid SymbolTableIndex");
+                                 "invalid SymbolTableIndex");
       R.Target = Sym->UniqueId;
       R.TargetName = Sym->Name;
     }
@@ -208,7 +208,7 @@
   } else {
     if (!CBFH)
       return createStringError(object_error::parse_failed,
-                               "No COFF file header returned");
+                               "no COFF file header returned");
     // Only copying the few fields from the bigobj header that we need
     // and won't recreate in the end.
     Obj->CoffFileHeader.Machine = CBFH->Machine;
diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
index e3dbe67..f3bb1ce 100644
--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
@@ -29,7 +29,7 @@
       const Symbol *Sym = Obj.findSymbol(R.Target);
       if (Sym == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Relocation target '%s' (%zu) not found",
+                                 "relocation target '%s' (%zu) not found",
                                  R.TargetName.str().c_str(), R.Target);
       R.Reloc.SymbolTableIndex = Sym->RawIndex;
     }
@@ -47,7 +47,7 @@
       const Section *Sec = Obj.findSection(Sym.TargetSectionId);
       if (Sec == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Symbol '%s' points to a removed section",
+                                 "symbol '%s' points to a removed section",
                                  Sym.Name.str().c_str());
       Sym.Sym.SectionNumber = Sec->Index;
 
@@ -66,7 +66,7 @@
           if (Sec == nullptr)
             return createStringError(
                 object_error::invalid_symbol_index,
-                "Symbol '%s' is associative to a removed section",
+                "symbol '%s' is associative to a removed section",
                 Sym.Name.str().c_str());
           SDSectionNumber = Sec->Index;
         }
@@ -83,7 +83,7 @@
       const Symbol *Target = Obj.findSymbol(*Sym.WeakTargetSymbolId);
       if (Target == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Symbol '%s' is missing its weak target",
+                                 "symbol '%s' is missing its weak target",
                                  Sym.Name.str().c_str());
       WE->TagIndex = Target->RawIndex;
     }
@@ -383,7 +383,7 @@
       if (Dir->RelativeVirtualAddress + Dir->Size >
           S.Header.VirtualAddress + S.Header.SizeOfRawData)
         return createStringError(object_error::parse_failed,
-                                 "Debug directory extends past end of section");
+                                 "debug directory extends past end of section");
 
       size_t Offset = Dir->RelativeVirtualAddress - S.Header.VirtualAddress;
       uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData + Offset;
@@ -400,14 +400,14 @@
     }
   }
   return createStringError(object_error::parse_failed,
-                           "Debug directory not found");
+                           "debug directory not found");
 }
 
 Error COFFWriter::write() {
   bool IsBigObj = Obj.getSections().size() > MaxNumberOfSections16;
   if (IsBigObj && Obj.IsPE)
     return createStringError(object_error::parse_failed,
-                             "Too many sections for executable");
+                             "too many sections for executable");
   return write(IsBigObj);
 }