Browse Source

Use the simpler version of llvm::sys::fs::exists.

In all these cases it looks like the intention was to handle error in a similar
way to the file not existing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217614 91177308-0d34-0410-b5e6-96231b3b80d8
Rafael Espindola 11 years ago
parent
commit
25f52a318b

+ 2 - 6
lib/ARCMigrate/FileRemapper.cpp

@@ -58,9 +58,7 @@ bool FileRemapper::initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
   assert(FromToMappings.empty() &&
          "initFromDisk should be called before any remap calls");
   std::string infoFile = filePath;
-  bool fileExists = false;
-  llvm::sys::fs::exists(infoFile, fileExists);
-  if (!fileExists)
+  if (!llvm::sys::fs::exists(infoFile))
     return false;
 
   std::vector<std::pair<const FileEntry *, const FileEntry *> > pairs;
@@ -173,9 +171,7 @@ bool FileRemapper::overwriteOriginal(DiagnosticsEngine &Diag,
          I = FromToMappings.begin(), E = FromToMappings.end(); I != E; ++I) {
     const FileEntry *origFE = I->first;
     assert(I->second.is<llvm::MemoryBuffer *>());
-    bool fileExists = false;
-    fs::exists(origFE->getName(), fileExists);
-    if (!fileExists)
+    if (!fs::exists(origFE->getName()))
       return report(StringRef("File does not exist: ") + origFE->getName(),
                     Diag);
 

+ 1 - 4
lib/Driver/Tools.cpp

@@ -7626,12 +7626,9 @@ void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
                                    const InputInfoList &Inputs,
                                    const ArgList &Args,
                                    const char *LinkingOutput) const {
-  bool UseGCC47 = false;
   const Driver &D = getToolChain().getDriver();
   ArgStringList CmdArgs;
-
-  if (llvm::sys::fs::exists("/usr/lib/gcc47", UseGCC47))
-    UseGCC47 = false;
+  bool UseGCC47 = llvm::sys::fs::exists("/usr/lib/gcc47");
 
   if (!D.SysRoot.empty())
     CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));

+ 2 - 5
tools/arcmt-test/arcmt-test.cpp

@@ -269,14 +269,11 @@ static bool verifyTransformedFiles(ArrayRef<std::string> resultFiles) {
       return true;
     }
 
-    bool exists = false;
-    sys::fs::exists(It->second, exists);
-    if (!exists) {
+    if (!sys::fs::exists(It->second)) {
       errs() << "error: '" << It->second << "' does not exist\n";
       return true;
     }
-    sys::fs::exists(inputResultFname, exists);
-    if (!exists) {
+    if (!sys::fs::exists(inputResultFname)) {
       errs() << "error: '" << inputResultFname << "' does not exist\n";
       return true;
     }

+ 1 - 2
tools/driver/driver.cpp

@@ -358,8 +358,7 @@ static void SetInstallDir(SmallVectorImpl<const char *> &argv,
   }
   llvm::sys::fs::make_absolute(InstalledPath);
   InstalledPath = llvm::sys::path::parent_path(InstalledPath);
-  bool exists;
-  if (!llvm::sys::fs::exists(InstalledPath.str(), exists) && exists)
+  if (llvm::sys::fs::exists(InstalledPath.c_str()))
     TheDriver.setInstalledDir(InstalledPath);
 }
 

+ 1 - 3
tools/libclang/ARCMigrate.cpp

@@ -47,9 +47,7 @@ CXRemapping clang_getRemappings(const char *migrate_dir_path) {
     return nullptr;
   }
 
-  bool exists = false;
-  llvm::sys::fs::exists(migrate_dir_path, exists);
-  if (!exists) {
+  if (!llvm::sys::fs::exists(migrate_dir_path)) {
     if (Logging) {
       llvm::errs() << "Error by clang_getRemappings(\"" << migrate_dir_path
                    << "\")\n";