Fix style.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Fri, 7 Nov 2014 21:30:36 +0000 (21:30 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Fri, 7 Nov 2014 21:30:36 +0000 (21:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221547 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/GraphWriter.cpp
tools/bugpoint/OptimizerDriver.cpp

index 3910b12da89bec495ce724434d514cc8b4cf0e25..054df528474e8b442713b575a3d69c3e2c2fd77f 100644 (file)
@@ -105,8 +105,7 @@ struct GraphSession {
     SmallVector<StringRef, 8> parts;
     Names.split(parts, "|");
     for (auto Name : parts) {
-      auto P = sys::findProgramByName(Name);
-      if (P) {
+      if (ErrorOr<std::string> P = sys::findProgramByName(Name)) {
         ProgramPath = *P;
         return true;
       }
index 752fc8950e5b88fd61da6f9240790bb9d9d33915..f197cc53926a252c41f8b35e2dbc3773a62d4565 100644 (file)
@@ -161,11 +161,10 @@ bool BugDriver::runPasses(Module *Program,
 
   std::string tool = OptCmd;
   if (OptCmd.empty()) {
-    auto Path = sys::findProgramByName("opt");
-    if (!Path)
-      errs() << Path.getError().message() << "\n";
-    else
+    if (ErrorOr<std::string> Path = sys::findProgramByName("opt"))
       tool = *Path;
+    else
+      errs() << Path.getError().message() << "\n";
   }
   if (tool.empty()) {
     errs() << "Cannot find `opt' in PATH!\n";
@@ -174,11 +173,10 @@ bool BugDriver::runPasses(Module *Program,
 
   std::string Prog;
   if (UseValgrind) {
-    auto Path = sys::findProgramByName("valgrind");
-    if (!Path)
-      errs() << Path.getError().message() << "\n";
-    else
+    if (ErrorOr<std::string> Path = sys::findProgramByName("valgrind"))
       Prog = *Path;
+    else
+      errs() << Path.getError().message() << "\n";
   } else
     Prog = tool;
   if (Prog.empty()) {