r210921 - Update for llvm api change.

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


Author: rafael
Date: Fri Jun 13 12:20:50 2014
New Revision: 210921

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

Modified:
    cfe/trunk/lib/Basic/VirtualFileSystem.cpp
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=210921&r1=210920&r2=210921&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Fri Jun 13 12:20:50 2014
@@ -14,6 +14,7 @@
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/YAMLParser.h"
@@ -198,10 +199,10 @@ ErrorOr<Status> OverlayFileSystem::statu
   // FIXME: handle symlinks that cross file systems
   for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {
     ErrorOr<Status> Status = (*I)->status(Path);
-    if (Status || Status.getError() != std::errc::no_such_file_or_directory)
+    if (Status || Status.getError() != llvm::errc::no_such_file_or_directory)
       return Status;
   }
-  return std::make_error_code(std::errc::no_such_file_or_directory);
+  return make_error_code(llvm::errc::no_such_file_or_directory);
 }
 
 std::error_code
@@ -210,10 +211,10 @@ OverlayFileSystem::openFileForRead(const
   // FIXME: handle symlinks that cross file systems
   for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {
     std::error_code EC = (*I)->openFileForRead(Path, Result);
-    if (!EC || EC != std::errc::no_such_file_or_directory)
+    if (!EC || EC != llvm::errc::no_such_file_or_directory)
       return EC;
   }
-  return std::make_error_code(std::errc::no_such_file_or_directory);
+  return make_error_code(llvm::errc::no_such_file_or_directory);
 }
 
 //===-----------------------------------------------------------------------===/
@@ -745,17 +746,17 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
     return EC;
 
   if (Path.empty())
-    return std::make_error_code(std::errc::invalid_argument);
+    return make_error_code(llvm::errc::invalid_argument);
 
   sys::path::const_iterator Start = sys::path::begin(Path);
   sys::path::const_iterator End = sys::path::end(Path);
   for (std::vector<Entry *>::iterator I = Roots.begin(), E = Roots.end();
        I != E; ++I) {
     ErrorOr<Entry *> Result = lookupPath(Start, End, *I);
-    if (Result || Result.getError() != std::errc::no_such_file_or_directory)
+    if (Result || Result.getError() != llvm::errc::no_such_file_or_directory)
       return Result;
   }
-  return std::make_error_code(std::errc::no_such_file_or_directory);
+  return make_error_code(llvm::errc::no_such_file_or_directory);
 }
 
 ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start,
@@ -768,7 +769,7 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
   if (CaseSensitive ? !Start->equals(From->getName())
                     : !Start->equals_lower(From->getName()))
     // failure to match
-    return std::make_error_code(std::errc::no_such_file_or_directory);
+    return make_error_code(llvm::errc::no_such_file_or_directory);
 
   ++Start;
 
@@ -779,16 +780,16 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
 
   DirectoryEntry *DE = dyn_cast<DirectoryEntry>(From);
   if (!DE)
-    return std::make_error_code(std::errc::not_a_directory);
+    return make_error_code(llvm::errc::not_a_directory);
 
   for (DirectoryEntry::iterator I = DE->contents_begin(),
                                 E = DE->contents_end();
        I != E; ++I) {
     ErrorOr<Entry *> Result = lookupPath(Start, End, *I);
-    if (Result || Result.getError() != std::errc::no_such_file_or_directory)
+    if (Result || Result.getError() != llvm::errc::no_such_file_or_directory)
       return Result;
   }
-  return std::make_error_code(std::errc::no_such_file_or_directory);
+  return make_error_code(llvm::errc::no_such_file_or_directory);
 }
 
 ErrorOr<Status> VFSFromYAML::status(const Twine &Path) {
@@ -822,7 +823,7 @@ VFSFromYAML::openFileForRead(const Twine
 
   FileEntry *F = dyn_cast<FileEntry>(*E);
   if (!F) // FIXME: errc::not_a_file?
-    return std::make_error_code(std::errc::invalid_argument);
+    return make_error_code(llvm::errc::invalid_argument);
 
   if (std::error_code EC =
           ExternalFS->openFileForRead(F->getExternalContentsPath(), Result))

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210921&r1=210920&r2=210921&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Fri Jun 13 12:20:50 2014
@@ -35,6 +35,7 @@
 #include "clang/Serialization/GlobalModuleIndex.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/LockFileManager.h"
@@ -572,7 +573,7 @@ CompilerInstance::createOutputFile(Strin
         llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
 
     if (CreateMissingDirectories &&
-        EC == std::errc::no_such_file_or_directory) {
+        EC == llvm::errc::no_such_file_or_directory) {
       StringRef Parent = llvm::sys::path::parent_path(OutputPath);
       EC = llvm::sys::fs::create_directories(Parent);
       if (!EC) {

Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210921&r1=210920&r2=210921&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Fri Jun 13 12:20:50 2014
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Basic/VirtualFileSystem.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SourceMgr.h"
@@ -35,7 +36,7 @@ public:
     std::map<std::string, vfs::Status>::iterator I =
         FilesAndDirs.find(Path.str());
     if (I == FilesAndDirs.end())
-      return std::make_error_code(std::errc::no_such_file_or_directory);
+      return make_error_code(llvm::errc::no_such_file_or_directory);
     return I->second;
   }
   std::error_code openFileForRead(const Twine &Path,
@@ -307,8 +308,8 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
   EXPECT_TRUE(S->equivalent(*O->status("//root/"))); // non-volatile UniqueID
 
   // broken mapping
-  EXPECT_EQ(std::errc::no_such_file_or_directory,
-            O->status("//root/file2").getError());
+  EXPECT_EQ(O->status("//root/file2").getError(),
+            llvm::errc::no_such_file_or_directory);
   EXPECT_EQ(0, NumDiagnostics);
 }
 
@@ -372,11 +373,11 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) {
   O->pushOverlay(FS);
 
   ErrorOr<vfs::Status> SS = O->status("//root/xx");
-  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
+  EXPECT_EQ(SS.getError(), llvm::errc::no_such_file_or_directory);
   SS = O->status("//root/xX");
-  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
+  EXPECT_EQ(SS.getError(), llvm::errc::no_such_file_or_directory);
   SS = O->status("//root/Xx");
-  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
+  EXPECT_EQ(SS.getError(), llvm::errc::no_such_file_or_directory);
   EXPECT_EQ(0, NumDiagnostics);
 }
 





More information about the cfe-commits mailing list