[llvm] r210737 - Don't put generic_category in the llvm namespace.

Rafael Espindola rafael.espindola at gmail.com
Wed Jun 11 19:00:40 PDT 2014


Author: rafael
Date: Wed Jun 11 21:00:39 2014
New Revision: 210737

URL: http://llvm.org/viewvc/llvm-project?rev=210737&view=rev
Log:
Don't put generic_category in the llvm namespace.

Modified:
    llvm/trunk/include/llvm/Support/system_error.h
    llvm/trunk/lib/Support/MemoryBuffer.cpp
    llvm/trunk/lib/Support/Path.cpp
    llvm/trunk/lib/Support/Unix/Memory.inc
    llvm/trunk/lib/Support/Unix/Path.inc
    llvm/trunk/lib/Support/Windows/Path.inc

Modified: llvm/trunk/include/llvm/Support/system_error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/system_error.h?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/system_error.h (original)
+++ llvm/trunk/include/llvm/Support/system_error.h Wed Jun 11 21:00:39 2014
@@ -18,7 +18,6 @@
 
 namespace llvm {
 using std::error_code;
-using std::generic_category;
 using std::make_error_code;
 }
 

Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Wed Jun 11 21:00:39 2014
@@ -222,7 +222,7 @@ static error_code getMemoryBufferForStre
     ReadBytes = read(FD, Buffer.end(), ChunkSize);
     if (ReadBytes == -1) {
       if (errno == EINTR) continue;
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
     }
     Buffer.set_size(Buffer.size() + ReadBytes);
   } while (ReadBytes != 0);
@@ -370,7 +370,7 @@ static error_code getOpenFileImpl(int FD
   size_t BytesLeft = MapSize;
 #ifndef HAVE_PREAD
   if (lseek(FD, Offset, SEEK_SET) == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 #endif
 
   while (BytesLeft) {
@@ -383,7 +383,7 @@ static error_code getOpenFileImpl(int FD
       if (errno == EINTR)
         continue;
       // Error while reading.
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
     }
     if (NumRead == 0) {
       memset(BufPtr, 0, BytesLeft); // zero-initialize rest of the buffer.

Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Wed Jun 11 21:00:39 2014
@@ -1030,7 +1030,7 @@ error_code identify_magic(const Twine &P
   char Buffer[32];
   int Length = read(FD, Buffer, sizeof(Buffer));
   if (Length < 0)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   Result = identify_magic(StringRef(Buffer, Length));
   return error_code();

Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Wed Jun 11 21:00:39 2014
@@ -95,7 +95,7 @@ Memory::allocateMappedMemory(size_t NumB
 #ifdef NEED_DEV_ZERO_FOR_MMAP
   static int zero_fd = open("/dev/zero", O_RDWR);
   if (zero_fd == -1) {
-    EC = error_code(errno, generic_category());
+    EC = error_code(errno, std::generic_category());
     return MemoryBlock();
   }
   fd = zero_fd;
@@ -123,7 +123,7 @@ Memory::allocateMappedMemory(size_t NumB
     if (NearBlock) //Try again without a near hint
       return allocateMappedMemory(NumBytes, nullptr, PFlags, EC);
 
-    EC = error_code(errno, generic_category());
+    EC = error_code(errno, std::generic_category());
     return MemoryBlock();
   }
 
@@ -143,7 +143,7 @@ Memory::releaseMappedMemory(MemoryBlock
     return error_code();
 
   if (0 != ::munmap(M.Address, M.Size))
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   M.Address = nullptr;
   M.Size = 0;
@@ -157,13 +157,13 @@ Memory::protectMappedMemory(const Memory
     return error_code();
 
   if (!Flags)
-    return error_code(EINVAL, generic_category());
+    return error_code(EINVAL, std::generic_category());
 
   int Protect = getPosixProtectionFlags(Flags);
 
   int Result = ::mprotect(M.Address, M.Size, Protect);
   if (Result != 0)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   if (Flags & MF_EXEC)
     Memory::InvalidateInstructionCache(M.Address, M.Size);

Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Wed Jun 11 21:00:39 2014
@@ -249,7 +249,7 @@ error_code current_path(SmallVectorImpl<
     if (::getcwd(result.data(), result.capacity()) == nullptr) {
       // See if there was a real error.
       if (errno != ENOMEM)
-        return error_code(errno, generic_category());
+        return error_code(errno, std::generic_category());
       // Otherwise there just wasn't enough space.
       result.reserve(result.capacity() * 2);
     } else
@@ -266,7 +266,7 @@ error_code create_directory(const Twine
 
   if (::mkdir(p.begin(), S_IRWXU | S_IRWXG) == -1) {
     if (errno != EEXIST || !IgnoreExisting)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
   }
 
   return error_code();
@@ -295,7 +295,7 @@ error_code create_link(const Twine &to,
   StringRef t = to.toNullTerminatedStringRef(to_storage);
 
   if (::symlink(t.begin(), f.begin()) == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   return error_code();
 }
@@ -307,7 +307,7 @@ error_code remove(const Twine &path, boo
   struct stat buf;
   if (lstat(p.begin(), &buf) != 0) {
     if (errno != ENOENT || !IgnoreNonExisting)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
     return error_code();
   }
 
@@ -321,7 +321,7 @@ error_code remove(const Twine &path, boo
 
   if (::remove(p.begin()) == -1) {
     if (errno != ENOENT || !IgnoreNonExisting)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
   }
 
   return error_code();
@@ -335,7 +335,7 @@ error_code rename(const Twine &from, con
   StringRef t = to.toNullTerminatedStringRef(to_storage);
 
   if (::rename(f.begin(), t.begin()) == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   return error_code();
 }
@@ -345,7 +345,7 @@ error_code resize_file(const Twine &path
   StringRef p = path.toNullTerminatedStringRef(path_storage);
 
   if (::truncate(p.begin(), size) == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   return error_code();
 }
@@ -356,7 +356,7 @@ error_code exists(const Twine &path, boo
 
   if (::access(p.begin(), F_OK) == -1) {
     if (errno != ENOENT)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
     result = false;
   } else
     result = true;
@@ -401,7 +401,7 @@ error_code equivalent(const Twine &A, co
 static error_code fillStatus(int StatRet, const struct stat &Status,
                              file_status &Result) {
   if (StatRet != 0) {
-    error_code ec(errno, generic_category());
+    error_code ec(errno, std::generic_category());
     if (ec == std::errc::no_such_file_or_directory)
       Result = file_status(file_type::file_not_found);
     else
@@ -454,7 +454,7 @@ error_code setLastModificationAndAccessT
   Times[0].tv_nsec = 0;
   Times[1] = Times[0];
   if (::futimens(FD, Times))
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
   return error_code();
 #elif defined(HAVE_FUTIMES)
   timeval Times[2];
@@ -462,7 +462,7 @@ error_code setLastModificationAndAccessT
   Times[0].tv_usec = 0;
   Times[1] = Times[0];
   if (::futimes(FD, Times))
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
   return error_code();
 #else
 #warning Missing futimes() and futimens()
@@ -478,7 +478,7 @@ error_code mapped_file_region::init(int
   // Figure out how large the file is.
   struct stat FileInfo;
   if (fstat(FD, &FileInfo) == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
   uint64_t FileSize = FileInfo.st_size;
 
   if (Size == 0)
@@ -486,7 +486,7 @@ error_code mapped_file_region::init(int
   else if (FileSize < Size) {
     // We need to grow the file.
     if (ftruncate(FD, Size) == -1)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
   }
 
   int flags = (Mode == readwrite) ? MAP_SHARED : MAP_PRIVATE;
@@ -496,7 +496,7 @@ error_code mapped_file_region::init(int
 #endif
   Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset);
   if (Mapping == MAP_FAILED)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
   return error_code();
 }
 
@@ -519,7 +519,7 @@ mapped_file_region::mapped_file_region(c
   int oflags = (mode == readonly) ? O_RDONLY : O_RDWR;
   int ofd = ::open(name.begin(), oflags);
   if (ofd == -1) {
-    ec = error_code(errno, generic_category());
+    ec = error_code(errno, std::generic_category());
     return;
   }
 
@@ -588,7 +588,7 @@ error_code detail::directory_iterator_co
   SmallString<128> path_null(path);
   DIR *directory = ::opendir(path_null.c_str());
   if (!directory)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 
   it.IterationHandle = reinterpret_cast<intptr_t>(directory);
   // Add something for replace_filename to replace.
@@ -609,7 +609,7 @@ error_code detail::directory_iterator_in
   errno = 0;
   dirent *cur_dir = ::readdir(reinterpret_cast<DIR *>(it.IterationHandle));
   if (cur_dir == nullptr && errno != 0) {
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
   } else if (cur_dir != nullptr) {
     StringRef name(cur_dir->d_name, NAMLEN(cur_dir));
     if ((name.size() == 1 && name[0] == '.') ||
@@ -627,7 +627,7 @@ error_code openFileForRead(const Twine &
   StringRef P = Name.toNullTerminatedStringRef(Storage);
   while ((ResultFD = open(P.begin(), O_RDONLY)) < 0) {
     if (errno != EINTR)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
   }
   return error_code();
 }
@@ -657,7 +657,7 @@ error_code openFileForWrite(const Twine
   StringRef P = Name.toNullTerminatedStringRef(Storage);
   while ((ResultFD = open(P.begin(), OpenFlags, Mode)) < 0) {
     if (errno != EINTR)
-      return error_code(errno, generic_category());
+      return error_code(errno, std::generic_category());
   }
   return error_code();
 }

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=210737&r1=210736&r2=210737&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Wed Jun 11 21:00:39 2014
@@ -259,14 +259,14 @@ error_code resize_file(const Twine &path
 
   int fd = ::_wopen(path_utf16.begin(), O_BINARY | _O_RDWR, S_IWRITE);
   if (fd == -1)
-    return error_code(errno, generic_category());
+    return error_code(errno, std::generic_category());
 #ifdef HAVE__CHSIZE_S
   errno_t error = ::_chsize_s(fd, size);
 #else
   errno_t error = ::_chsize(fd, size);
 #endif
   ::close(fd);
-  return error_code(error, generic_category());
+  return error_code(error, std::generic_category());
 }
 
 error_code exists(const Twine &path, bool &result) {





More information about the llvm-commits mailing list