[lld] r210919 - Update for llvm api change.

Rafael Espindola rafael.espindola at gmail.com
Fri Jun 13 10:20:48 PDT 2014


Author: rafael
Date: Fri Jun 13 12:20:48 2014
New Revision: 210919

URL: http://llvm.org/viewvc/llvm-project?rev=210919&view=rev
Log:
Update for llvm api change.

Modified:
    lld/trunk/include/lld/Driver/CoreInputGraph.h
    lld/trunk/lib/Driver/GnuLdDriver.cpp
    lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
    lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
    lld/trunk/lib/ReaderWriter/Reader.cpp
    lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp

Modified: lld/trunk/include/lld/Driver/CoreInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/CoreInputGraph.h?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/CoreInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/CoreInputGraph.h Fri Jun 13 12:20:48 2014
@@ -20,6 +20,7 @@
 #include "lld/Core/InputGraph.h"
 #include "lld/ReaderWriter/CoreLinkingContext.h"
 #include "lld/ReaderWriter/Reader.h"
+#include "llvm/Support/Errc.h"
 
 #include <map>
 #include <memory>
@@ -34,10 +35,9 @@ public:
   /// \brief Parse the input file to lld::File.
   std::error_code parse(const LinkingContext &ctx,
                         raw_ostream &diagnostics) override {
-    using std::make_error_code;
     ErrorOr<StringRef> filePath = getPath(ctx);
-    if (filePath.getError() == std::errc::no_such_file_or_directory)
-      return make_error_code(std::errc::no_such_file_or_directory);
+    if (filePath.getError() == llvm::errc::no_such_file_or_directory)
+      return make_error_code(llvm::errc::no_such_file_or_directory);
 
     // Create a memory buffer
     std::unique_ptr<MemoryBuffer> mb;

Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Fri Jun 13 12:20:48 2014
@@ -24,6 +24,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -159,7 +160,7 @@ llvm::ErrorOr<StringRef> ELFFileNode::ge
 }
 
 std::string ELFFileNode::errStr(std::error_code errc) {
-  if (errc == std::errc::no_such_file_or_directory) {
+  if (errc == llvm::errc::no_such_file_or_directory) {
     if (_attributes._isDashlPrefix)
       return (Twine("Unable to find library -l") + _path).str();
     return (Twine("Unable to find file ") + _path).str();

Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Fri Jun 13 12:20:48 2014
@@ -27,6 +27,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/Format.h"
 
 #include <map>
@@ -541,13 +542,12 @@ AtomSection<ELFT> *DefaultLayout<ELFT>::
 
 template <class ELFT>
 ErrorOr<const lld::AtomLayout &> DefaultLayout<ELFT>::addAtom(const Atom *atom) {
-  using std::make_error_code;
   if (const DefinedAtom *definedAtom = dyn_cast<DefinedAtom>(atom)) {
     // HACK: Ignore undefined atoms. We need to adjust the interface so that
     // undefined atoms can still be included in the output symbol table for
     // -noinhibit-exec.
     if (definedAtom->contentType() == DefinedAtom::typeUnknown)
-      return make_error_code(std::errc::invalid_argument);
+      return make_error_code(llvm::errc::invalid_argument);
     const DefinedAtom::ContentPermissions permissions =
         definedAtom->permissions();
     const DefinedAtom::ContentType contentType = definedAtom->contentType();

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Fri Jun 13 12:20:48 2014
@@ -19,6 +19,7 @@
 #include "lld/Passes/RoundTripYAMLPass.h"
 
 #include "llvm/ADT/Triple.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/ELF.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
@@ -178,7 +179,7 @@ ErrorOr<StringRef> ELFLinkingContext::se
       return StringRef(*new (_allocator) std::string(path.str()));
   }
   if (!llvm::sys::fs::exists(libName))
-    return std::make_error_code(std::errc::no_such_file_or_directory);
+    return make_error_code(llvm::errc::no_such_file_or_directory);
 
   return libName;
 }
@@ -195,7 +196,7 @@ ErrorOr<StringRef> ELFLinkingContext::se
     return fileName;
 
   if (llvm::sys::path::is_absolute(fileName))
-    return std::make_error_code(std::errc::no_such_file_or_directory);
+    return make_error_code(llvm::errc::no_such_file_or_directory);
 
   for (StringRef dir : _inputSearchPaths) {
     buildSearchPath(path, dir, _sysrootPath);
@@ -203,7 +204,7 @@ ErrorOr<StringRef> ELFLinkingContext::se
     if (llvm::sys::fs::exists(path.str()))
       return StringRef(*new (_allocator) std::string(path.str()));
   }
-  return std::make_error_code(std::errc::no_such_file_or_directory);
+  return make_error_code(llvm::errc::no_such_file_or_directory);
 }
 
 void ELFLinkingContext::createInternalFiles(

Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp Fri Jun 13 12:20:48 2014
@@ -31,6 +31,7 @@
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileOutputBuffer.h"
 #include "llvm/Support/Host.h"
@@ -61,7 +62,7 @@ static std::error_code forEachLoadComman
       slc = &lcCopy;
     }
     if ( (p + slc->cmdsize) > lcRange.end() )
-      return std::make_error_code(std::errc::executable_format_error);
+      return make_error_code(llvm::errc::executable_format_error);
 
     if (func(slc->cmd, slc->cmdsize, p))
       return std::error_code();
@@ -76,7 +77,7 @@ static std::error_code appendRelocations
                                          bool swap, bool bigEndian,
                                          uint32_t reloff, uint32_t nreloc) {
   if ((reloff + nreloc*8) > buffer.size())
-    return std::make_error_code(std::errc::executable_format_error);
+    return make_error_code(llvm::errc::executable_format_error);
   const any_relocation_info* relocsArray =
             reinterpret_cast<const any_relocation_info*>(buffer.begin()+reloff);
 
@@ -91,9 +92,9 @@ appendIndirectSymbols(IndirectSymbols &i
                       bool bigEndian, uint32_t istOffset, uint32_t istCount,
                       uint32_t startIndex, uint32_t count) {
   if ((istOffset + istCount*4) > buffer.size())
-    return std::make_error_code(std::errc::executable_format_error);
+    return make_error_code(llvm::errc::executable_format_error);
   if (startIndex+count  > istCount)
-    return std::make_error_code(std::errc::executable_format_error);
+    return make_error_code(llvm::errc::executable_format_error);
   const uint32_t *indirectSymbolArray =
             reinterpret_cast<const uint32_t*>(buffer.begin()+istOffset);
 
@@ -141,12 +142,12 @@ readBinary(std::unique_ptr<MemoryBuffer>
       fa++;
     }
     if (!foundArch) {
-      return std::make_error_code(std::errc::executable_format_error);
+      return make_error_code(llvm::errc::executable_format_error);
     }
     objSize = readBigEndian(fa->size);
     uint32_t offset = readBigEndian(fa->offset);
     if ((offset + objSize) > mb->getBufferSize())
-      return std::make_error_code(std::errc::executable_format_error);
+      return make_error_code(llvm::errc::executable_format_error);
     start += offset;
     mh = reinterpret_cast<const mach_header *>(start);
   }
@@ -170,7 +171,7 @@ readBinary(std::unique_ptr<MemoryBuffer>
     swap = true;
     break;
   default:
-    return std::make_error_code(std::errc::executable_format_error);
+    return make_error_code(llvm::errc::executable_format_error);
   }
 
   // Endian swap header, if needed.
@@ -188,7 +189,7 @@ readBinary(std::unique_ptr<MemoryBuffer>
       start + (is64 ? sizeof(mach_header_64) : sizeof(mach_header));
   StringRef lcRange(lcStart, smh->sizeofcmds);
   if (lcRange.end() > (start + objSize))
-    return std::make_error_code(std::errc::executable_format_error);
+    return make_error_code(llvm::errc::executable_format_error);
 
   // Normalize architecture
   f->arch = MachOLinkingContext::archFromCpuType(smh->cputype, smh->cpusubtype);

Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Fri Jun 13 12:20:48 2014
@@ -29,6 +29,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileOutputBuffer.h"
@@ -376,7 +377,7 @@ void MachOFileLayout::buildFileOffsets()
       if (&sg1 == &sg2)
         continue;
       if (overlaps(sg1,sg2)) {
-        _ec = std::make_error_code(std::errc::executable_format_error);
+        _ec = make_error_code(llvm::errc::executable_format_error);
         return;
       }
     }
@@ -388,7 +389,7 @@ void MachOFileLayout::buildFileOffsets()
       if (&s1 == &s2)
         continue;
       if (overlaps(s1,s2)) {
-        _ec = std::make_error_code(std::errc::executable_format_error);
+        _ec = make_error_code(llvm::errc::executable_format_error);
         return;
       }
     }
@@ -409,7 +410,7 @@ void MachOFileLayout::buildFileOffsets()
       if ((s.address >= sg.address)
                         && (s.address+s.content.size() <= sg.address+sg.size)) {
         if (!sg.name.equals(s.segmentName)) {
-          _ec = std::make_error_code(std::errc::executable_format_error);
+          _ec = make_error_code(llvm::errc::executable_format_error);
           return;
         }
         _segInfo[&sg].sections.push_back(&s);

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Jun 13 12:20:48 2014
@@ -20,6 +20,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileOutputBuffer.h"
 #include "llvm/Support/FileUtilities.h"
@@ -983,7 +984,7 @@ private:
     std::string programPath = llvm::sys::FindProgramByName(program);
     if (programPath.empty()) {
       llvm::errs() << "Unable to find " << program << " in PATH\n";
-      return std::errc::broken_pipe;
+      return llvm::errc::broken_pipe;
     }
     std::vector<const char *> args;
     args.push_back(programPath.c_str());
@@ -1002,7 +1003,7 @@ private:
 
     if (llvm::sys::ExecuteAndWait(programPath.c_str(), &args[0]) != 0) {
       llvm::errs() << program << " failed\n";
-      return std::errc::broken_pipe;
+      return llvm::errc::broken_pipe;
     }
     return outFilePath.str().str();
   }

Modified: lld/trunk/lib/ReaderWriter/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Reader.cpp Fri Jun 13 12:20:48 2014
@@ -9,6 +9,7 @@
 
 #include "lld/ReaderWriter/Reader.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
@@ -42,7 +43,7 @@ Registry::parseFile(std::unique_ptr<Memo
       return reader->parseFile(mb, *this, result);
 
   // No Reader could parse this file.
-  return std::make_error_code(std::errc::executable_format_error);
+  return make_error_code(llvm::errc::executable_format_error);
 }
 
 static const Registry::KindStrings kindStrings[] = {

Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=210919&r1=210918&r2=210919&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Fri Jun 13 12:20:48 2014
@@ -21,6 +21,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -1249,7 +1250,7 @@ public:
     std::string errorInfo;
     llvm::raw_fd_ostream out(outPath.data(), errorInfo, llvm::sys::fs::F_Text);
     if (!errorInfo.empty())
-      return std::make_error_code(std::errc::no_such_file_or_directory);
+      return make_error_code(llvm::errc::no_such_file_or_directory);
 
     // Create yaml Output writer, using yaml options for context.
     YamlContext yamlContext;





More information about the llvm-commits mailing list