r210817 - Refer to error_code with the std prefix.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 12 13:37:59 PDT 2014


Author: rafael
Date: Thu Jun 12 15:37:59 2014
New Revision: 210817

URL: http://llvm.org/viewvc/llvm-project?rev=210817&view=rev
Log:
Refer to error_code with the std prefix.

Modified:
    cfe/trunk/lib/AST/InheritViz.cpp
    cfe/trunk/lib/Basic/VirtualFileSystem.cpp
    cfe/trunk/lib/Frontend/FrontendActions.cpp
    cfe/trunk/tools/clang-format/ClangFormat.cpp
    cfe/trunk/tools/driver/cc1as_main.cpp
    cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Modified: cfe/trunk/lib/AST/InheritViz.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/InheritViz.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/lib/AST/InheritViz.cpp (original)
+++ cfe/trunk/lib/AST/InheritViz.cpp Thu Jun 12 15:37:59 2014
@@ -139,7 +139,7 @@ void CXXRecordDecl::viewInheritance(ASTC
 
   int FD;
   SmallString<128> Filename;
-  error_code EC =
+  std::error_code EC =
       sys::fs::createTemporaryFile(Self.getAsString(), "dot", FD, Filename);
   if (EC) {
     llvm::errs() << "Error: " << EC.message() << "\n";

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Thu Jun 12 15:37:59 2014
@@ -65,17 +65,15 @@ File::~File() {}
 
 FileSystem::~FileSystem() {}
 
-error_code FileSystem::getBufferForFile(const llvm::Twine &Name,
-                                        std::unique_ptr<MemoryBuffer> &Result,
-                                        int64_t FileSize,
-                                        bool RequiresNullTerminator,
-                                        bool IsVolatile) {
+std::error_code FileSystem::getBufferForFile(
+    const llvm::Twine &Name, std::unique_ptr<MemoryBuffer> &Result,
+    int64_t FileSize, bool RequiresNullTerminator, bool IsVolatile) {
   std::unique_ptr<File> F;
-  if (error_code EC = openFileForRead(Name, F))
+  if (std::error_code EC = openFileForRead(Name, F))
     return EC;
 
-  error_code EC = F->getBuffer(Name, Result, FileSize, RequiresNullTerminator,
-                               IsVolatile);
+  std::error_code EC =
+      F->getBuffer(Name, Result, FileSize, RequiresNullTerminator, IsVolatile);
   return EC;
 }
 
@@ -96,11 +94,12 @@ class RealFile : public File {
 public:
   ~RealFile();
   ErrorOr<Status> status() override;
-  error_code getBuffer(const Twine &Name, std::unique_ptr<MemoryBuffer> &Result,
-                       int64_t FileSize = -1,
-                       bool RequiresNullTerminator = true,
-                       bool IsVolatile = false) override;
-  error_code close() override;
+  std::error_code getBuffer(const Twine &Name,
+                            std::unique_ptr<MemoryBuffer> &Result,
+                            int64_t FileSize = -1,
+                            bool RequiresNullTerminator = true,
+                            bool IsVolatile = false) override;
+  std::error_code close() override;
   void setName(StringRef Name) override;
 };
 } // end anonymous namespace
@@ -110,7 +109,7 @@ ErrorOr<Status> RealFile::status() {
   assert(FD != -1 && "cannot stat closed file");
   if (!S.isStatusKnown()) {
     file_status RealStatus;
-    if (error_code EC = sys::fs::status(FD, RealStatus))
+    if (std::error_code EC = sys::fs::status(FD, RealStatus))
       return EC;
     Status NewS(RealStatus);
     NewS.setName(S.getName());
@@ -119,10 +118,11 @@ ErrorOr<Status> RealFile::status() {
   return S;
 }
 
-error_code RealFile::getBuffer(const Twine &Name,
-                               std::unique_ptr<MemoryBuffer> &Result,
-                               int64_t FileSize, bool RequiresNullTerminator,
-                               bool IsVolatile) {
+std::error_code RealFile::getBuffer(const Twine &Name,
+                                    std::unique_ptr<MemoryBuffer> &Result,
+                                    int64_t FileSize,
+                                    bool RequiresNullTerminator,
+                                    bool IsVolatile) {
   assert(FD != -1 && "cannot get buffer for closed file");
   return MemoryBuffer::getOpenFile(FD, Name.str().c_str(), Result, FileSize,
                                    RequiresNullTerminator, IsVolatile);
@@ -138,11 +138,11 @@ error_code RealFile::getBuffer(const Twi
 #define S_ISFIFO(x) (0)
 #endif
 #endif
-error_code RealFile::close() {
+std::error_code RealFile::close() {
   if (::close(FD))
-    return error_code(errno, std::generic_category());
+    return std::error_code(errno, std::generic_category());
   FD = -1;
-  return error_code();
+  return std::error_code();
 }
 
 void RealFile::setName(StringRef Name) {
@@ -154,28 +154,28 @@ namespace {
 class RealFileSystem : public FileSystem {
 public:
   ErrorOr<Status> status(const Twine &Path) override;
-  error_code openFileForRead(const Twine &Path,
-                             std::unique_ptr<File> &Result) override;
+  std::error_code openFileForRead(const Twine &Path,
+                                  std::unique_ptr<File> &Result) override;
 };
 } // end anonymous namespace
 
 ErrorOr<Status> RealFileSystem::status(const Twine &Path) {
   sys::fs::file_status RealStatus;
-  if (error_code EC = sys::fs::status(Path, RealStatus))
+  if (std::error_code EC = sys::fs::status(Path, RealStatus))
     return EC;
   Status Result(RealStatus);
   Result.setName(Path.str());
   return Result;
 }
 
-error_code RealFileSystem::openFileForRead(const Twine &Name,
-                                           std::unique_ptr<File> &Result) {
+std::error_code RealFileSystem::openFileForRead(const Twine &Name,
+                                                std::unique_ptr<File> &Result) {
   int FD;
-  if (error_code EC = sys::fs::openFileForRead(Name, FD))
+  if (std::error_code EC = sys::fs::openFileForRead(Name, FD))
     return EC;
   Result.reset(new RealFile(FD));
   Result->setName(Name.str());
-  return error_code();
+  return std::error_code();
 }
 
 IntrusiveRefCntPtr<FileSystem> vfs::getRealFileSystem() {
@@ -204,11 +204,12 @@ ErrorOr<Status> OverlayFileSystem::statu
   return std::make_error_code(std::errc::no_such_file_or_directory);
 }
 
-error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path,
-                                              std::unique_ptr<File> &Result) {
+std::error_code
+OverlayFileSystem::openFileForRead(const llvm::Twine &Path,
+                                   std::unique_ptr<File> &Result) {
   // FIXME: handle symlinks that cross file systems
   for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {
-    error_code EC = (*I)->openFileForRead(Path, Result);
+    std::error_code EC = (*I)->openFileForRead(Path, Result);
     if (!EC || EC != std::errc::no_such_file_or_directory)
       return EC;
   }
@@ -389,8 +390,8 @@ public:
                              IntrusiveRefCntPtr<FileSystem> ExternalFS);
 
   ErrorOr<Status> status(const Twine &Path) override;
-  error_code openFileForRead(const Twine &Path,
-                             std::unique_ptr<File> &Result) override;
+  std::error_code openFileForRead(const Twine &Path,
+                                  std::unique_ptr<File> &Result) override;
 };
 
 /// \brief A helper class to hold the common YAML parsing state.
@@ -740,7 +741,7 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
   Path_.toVector(Path);
 
   // Handle relative paths
-  if (error_code EC = sys::fs::make_absolute(Path))
+  if (std::error_code EC = sys::fs::make_absolute(Path))
     return EC;
 
   if (Path.empty())
@@ -812,8 +813,9 @@ ErrorOr<Status> VFSFromYAML::status(cons
   }
 }
 
-error_code VFSFromYAML::openFileForRead(const Twine &Path,
-                                        std::unique_ptr<vfs::File> &Result) {
+std::error_code
+VFSFromYAML::openFileForRead(const Twine &Path,
+                             std::unique_ptr<vfs::File> &Result) {
   ErrorOr<Entry *> E = lookupPath(Path);
   if (!E)
     return E.getError();
@@ -822,14 +824,14 @@ error_code VFSFromYAML::openFileForRead(
   if (!F) // FIXME: errc::not_a_file?
     return std::make_error_code(std::errc::invalid_argument);
 
-  if (error_code EC = ExternalFS->openFileForRead(F->getExternalContentsPath(),
-                                                  Result))
+  if (std::error_code EC =
+          ExternalFS->openFileForRead(F->getExternalContentsPath(), Result))
     return EC;
 
   if (!F->useExternalName(UseExternalNames))
     Result->setName(Path.str());
 
-  return error_code();
+  return std::error_code();
 }
 
 IntrusiveRefCntPtr<FileSystem>

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Thu Jun 12 15:37:59 2014
@@ -310,7 +310,7 @@ bool GenerateModuleAction::BeginSourceFi
 
   // Collect the set of #includes we need to build the module.
   SmallString<256> HeaderContents;
-  std::error_code Err = llvm::error_code();
+  std::error_code Err = std::error_code();
   if (const FileEntry *UmbrellaHeader = Module->getUmbrellaHeader())
     Err = addHeaderInclude(UmbrellaHeader, HeaderContents, CI.getLangOpts(),
                            Module->IsExternC);

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Thu Jun 12 15:37:59 2014
@@ -210,7 +210,7 @@ static bool format(StringRef FileName) {
       new DiagnosticOptions);
   SourceManager Sources(Diagnostics, Files);
   std::unique_ptr<MemoryBuffer> Code;
-  if (error_code ec = MemoryBuffer::getFileOrSTDIN(FileName, Code)) {
+  if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(FileName, Code)) {
     llvm::errs() << ec.message() << "\n";
     return true;
   }

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Jun 12 15:37:59 2014
@@ -282,7 +282,8 @@ static bool ExecuteAssembler(AssemblerIn
     return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
 
   std::unique_ptr<MemoryBuffer> Buffer;
-  if (error_code ec = MemoryBuffer::getFileOrSTDIN(Opts.InputFile, Buffer)) {
+  if (std::error_code ec =
+          MemoryBuffer::getFileOrSTDIN(Opts.InputFile, Buffer)) {
     Error = ec.message();
     return Diags.Report(diag::err_fe_error_reading) << Opts.InputFile;
   }

Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210817&r1=210816&r2=210817&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Thu Jun 12 15:37:59 2014
@@ -38,14 +38,14 @@ public:
       return std::make_error_code(std::errc::no_such_file_or_directory);
     return I->second;
   }
-  error_code openFileForRead(const Twine &Path,
-                             std::unique_ptr<vfs::File> &Result) {
+  std::error_code openFileForRead(const Twine &Path,
+                                  std::unique_ptr<vfs::File> &Result) {
     llvm_unreachable("unimplemented");
   }
-  error_code getBufferForFile(const Twine &Name,
-                              std::unique_ptr<MemoryBuffer> &Result,
-                              int64_t FileSize = -1,
-                              bool RequiresNullTerminator = true) {
+  std::error_code getBufferForFile(const Twine &Name,
+                                   std::unique_ptr<MemoryBuffer> &Result,
+                                   int64_t FileSize = -1,
+                                   bool RequiresNullTerminator = true) {
     llvm_unreachable("unimplemented");
   }
 
@@ -75,7 +75,7 @@ public:
 
 TEST(VirtualFileSystemTest, StatusQueries) {
   IntrusiveRefCntPtr<DummyFileSystem> D(new DummyFileSystem());
-  ErrorOr<vfs::Status> Status((error_code()));
+  ErrorOr<vfs::Status> Status((std::error_code()));
 
   D->addRegularFile("/foo");
   Status = D->status("/foo");
@@ -115,7 +115,7 @@ TEST(VirtualFileSystemTest, StatusQuerie
 
 TEST(VirtualFileSystemTest, BaseOnlyOverlay) {
   IntrusiveRefCntPtr<DummyFileSystem> D(new DummyFileSystem());
-  ErrorOr<vfs::Status> Status((error_code()));
+  ErrorOr<vfs::Status> Status((std::error_code()));
   EXPECT_FALSE(Status = D->status("/foo"));
 
   IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(new vfs::OverlayFileSystem(D));
@@ -125,7 +125,7 @@ TEST(VirtualFileSystemTest, BaseOnlyOver
   Status = D->status("/foo");
   EXPECT_FALSE(Status.getError());
 
-  ErrorOr<vfs::Status> Status2((error_code()));
+  ErrorOr<vfs::Status> Status2((std::error_code()));
   Status2 = O->status("/foo");
   EXPECT_FALSE(Status2.getError());
   EXPECT_TRUE(Status->equivalent(*Status2));
@@ -140,9 +140,10 @@ TEST(VirtualFileSystemTest, OverlayFiles
   O->pushOverlay(Middle);
   O->pushOverlay(Top);
 
-  ErrorOr<vfs::Status> Status1((error_code())), Status2((error_code())),
-      Status3((error_code())), StatusB((error_code())), StatusM((error_code())),
-      StatusT((error_code()));
+  ErrorOr<vfs::Status> Status1((std::error_code())),
+      Status2((std::error_code())), Status3((std::error_code())),
+      StatusB((std::error_code())), StatusM((std::error_code())),
+      StatusT((std::error_code()));
 
   Base->addRegularFile("/foo");
   StatusB = Base->status("/foo");
@@ -201,7 +202,7 @@ TEST(VirtualFileSystemTest, MergedDirPer
       new vfs::OverlayFileSystem(Lower));
   O->pushOverlay(Upper);
 
-  ErrorOr<vfs::Status> Status((error_code()));
+  ErrorOr<vfs::Status> Status((std::error_code()));
   Lower->addDirectory("/both", sys::fs::owner_read);
   Upper->addDirectory("/both", sys::fs::owner_all | sys::fs::group_read);
   Status = O->status("/both");





More information about the cfe-commits mailing list