OSDN Git Service

[NFC] yaml2obj/yam2elf.cpp whitespace changes: dos2unix removed CRs.
authorPuyan Lotfi <puyan@puyan.org>
Sat, 11 May 2019 17:03:36 +0000 (17:03 +0000)
committerPuyan Lotfi <puyan@puyan.org>
Sat, 11 May 2019 17:03:36 +0000 (17:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360527 91177308-0d34-0410-b5e6-96231b3b80d8

tools/yaml2obj/yaml2elf.cpp

index 48da026..79de01e 100644 (file)
@@ -60,28 +60,28 @@ public:
 // sections and symbols can be referenced by name instead of by index.
 namespace {
 class NameToIdxMap {
-  StringMap<unsigned> Map;\r
-\r
+  StringMap<unsigned> Map;
+
 public:
-  /// \Returns false if name is already present in the map.\r
-  bool addName(StringRef Name, unsigned Ndx) {\r
-    return Map.insert({Name, Ndx}).second;\r
+  /// \Returns false if name is already present in the map.
+  bool addName(StringRef Name, unsigned Ndx) {
+    return Map.insert({Name, Ndx}).second;
   }
-  /// \Returns false if name is not present in the map.\r
+  /// \Returns false if name is not present in the map.
   bool lookup(StringRef Name, unsigned &Idx) const {
-    auto I = Map.find(Name);\r
+    auto I = Map.find(Name);
     if (I == Map.end())
-      return false;\r
+      return false;
     Idx = I->getValue();
-    return true;\r
+    return true;
   }
-  /// Asserts if name is not present in the map.\r
+  /// Asserts if name is not present in the map.
   unsigned get(StringRef Name) const {
-    unsigned Idx;\r
-    if (lookup(Name, Idx))\r
-      return Idx;\r
-    assert(false && "Expected section not found in index");\r
-    return 0;\r
+    unsigned Idx;
+    if (lookup(Name, Idx))
+      return Idx;
+    assert(false && "Expected section not found in index");
+    return 0;
   }
   unsigned size() const { return Map.size(); }
 };
@@ -239,7 +239,7 @@ void ELFState<ELFT>::initProgramHeaders(std::vector<Elf_Phdr> &PHeaders) {
 
 static bool convertSectionIndex(NameToIdxMap &SN2I, StringRef SecName,
                                 StringRef IndexSrc, unsigned &IndexDest) {
-  if (!SN2I.lookup(IndexSrc, IndexDest) && !to_integer(IndexSrc, IndexDest)) {\r
+  if (!SN2I.lookup(IndexSrc, IndexDest) && !to_integer(IndexSrc, IndexDest)) {
     WithColor::error() << "Unknown section referenced: '" << IndexSrc
                        << "' at YAML section '" << SecName << "'.\n";
     return false;
@@ -393,13 +393,13 @@ void ELFState<ELFT>::setProgramHeaderLayout(std::vector<Elf_Phdr> &PHeaders,
   for (auto &YamlPhdr : Doc.ProgramHeaders) {
     Elf_Phdr &PHeader = PHeaders[PhdrIdx++];
 
-    std::vector<Elf_Shdr *> Sections;\r
-    for (const ELFYAML::SectionName &SecName : YamlPhdr.Sections) {\r
-      unsigned Index;\r
-      if (!SN2I.lookup(SecName.Section, Index)) {\r
-        WithColor::error() << "Unknown section referenced: '" << SecName.Section\r
-                           << "' by program header.\n";\r
-        exit(1);\r
+    std::vector<Elf_Shdr *> Sections;
+    for (const ELFYAML::SectionName &SecName : YamlPhdr.Sections) {
+      unsigned Index;
+      if (!SN2I.lookup(SecName.Section, Index)) {
+        WithColor::error() << "Unknown section referenced: '" << SecName.Section
+                           << "' by program header.\n";
+        exit(1);
       }
       Sections.push_back(&SHeaders[Index]);
     }
@@ -480,7 +480,7 @@ void ELFState<ELFT>::addSymbols(ArrayRef<ELFYAML::Symbol> Symbols,
     Symbol.setBindingAndType(Sym.Binding, Sym.Type);
     if (!Sym.Section.empty()) {
       unsigned Index;
-      if (!SN2I.lookup(Sym.Section, Index)) {\r
+      if (!SN2I.lookup(Sym.Section, Index)) {
         WithColor::error() << "Unknown section referenced: '" << Sym.Section
                            << "' by YAML symbol " << Sym.Name << ".\n";
         exit(1);
@@ -554,7 +554,7 @@ ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
     unsigned SymIdx = 0;
     // If a relocation references a symbol, try to look one up in the symbol
     // table. If it is not there, treat the value as a symbol index.
-    if (Rel.Symbol && !SymN2I.lookup(*Rel.Symbol, SymIdx) &&\r
+    if (Rel.Symbol && !SymN2I.lookup(*Rel.Symbol, SymIdx) &&
         !to_integer(*Rel.Symbol, SymIdx)) {
       WithColor::error() << "Unknown symbol referenced: '" << *Rel.Symbol
                          << "' at YAML section '" << Section.Name << "'.\n";
@@ -589,11 +589,11 @@ bool ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
   SHeader.sh_entsize = 4;
   SHeader.sh_size = SHeader.sh_entsize * Section.Members.size();
 
-  unsigned SymIdx;\r
-  if (!SymN2I.lookup(Section.Signature, SymIdx) &&\r
-      !to_integer(Section.Signature, SymIdx)) {\r
-    WithColor::error() << "Unknown symbol referenced: '" << Section.Signature\r
-                       << "' at YAML section '" << Section.Name << "'.\n";\r
+  unsigned SymIdx;
+  if (!SymN2I.lookup(Section.Signature, SymIdx) &&
+      !to_integer(Section.Signature, SymIdx)) {
+    WithColor::error() << "Unknown symbol referenced: '" << Section.Signature
+                       << "' at YAML section '" << Section.Name << "'.\n";
     return false;
   }
   SHeader.sh_info = SymIdx;
@@ -791,7 +791,7 @@ template <class ELFT> bool ELFState<ELFT>::buildSectionIndex() {
     StringRef Name = Doc.Sections[i]->Name;
     DotShStrtab.add(Name);
     // "+ 1" to take into account the SHT_NULL entry.
-    if (!SN2I.addName(Name, i + 1)) {\r
+    if (!SN2I.addName(Name, i + 1)) {
       WithColor::error() << "Repeated section name: '" << Name
                          << "' at YAML section number " << i << ".\n";
       return false;
@@ -827,7 +827,7 @@ bool ELFState<ELFT>::buildSymbolIndex(ArrayRef<ELFYAML::Symbol> Symbols) {
     if (Sym.Binding.value != ELF::STB_LOCAL)
       GlobalSymbolSeen = true;
 
-    if (!Name.empty() && !SymN2I.addName(Name, I)) {\r
+    if (!Name.empty() && !SymN2I.addName(Name, I)) {
       WithColor::error() << "Repeated symbol name: '" << Name << "'.\n";
       return false;
     }