[llvm] r324622 - [dsymutil] Use llvm::sys::path to join bundle path.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 08:31:43 PST 2018


Author: jdevlieghere
Date: Thu Feb  8 08:31:42 2018
New Revision: 324622

URL: http://llvm.org/viewvc/llvm-project?rev=324622&view=rev
Log:
[dsymutil] Use llvm::sys::path to join bundle path.

When processing a dSYM bundle, use llvm::sys::path to join the different
path components instead of using a string with hard coded forward
slashes as separators.

Modified:
    llvm/trunk/tools/dsymutil/dsymutil.cpp

Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=324622&r1=324621&r2=324622&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Thu Feb  8 08:31:42 2018
@@ -329,8 +329,9 @@ static Expected<std::vector<std::string>
     }
 
     // Make sure that we're dealing with a dSYM bundle.
-    std::string dSYMDir = Input + "/Contents/Resources/DWARF";
-    if (!llvm::sys::fs::is_directory(dSYMDir))
+    SmallString<256> BundlePath(Input);
+    sys::path::append(BundlePath, "Contents", "Resources", "DWARF");
+    if (!llvm::sys::fs::is_directory(BundlePath))
       return make_error<StringError>(
           Input + " is a directory, but doesn't look like a dSYM bundle.",
           inconvertibleErrorCode());
@@ -338,7 +339,7 @@ static Expected<std::vector<std::string>
     // Create a directory iterator to iterate over all the entries in the
     // bundle.
     std::error_code EC;
-    llvm::sys::fs::directory_iterator DirIt(dSYMDir, EC);
+    llvm::sys::fs::directory_iterator DirIt(BundlePath, EC);
     llvm::sys::fs::directory_iterator DirEnd;
     if (EC)
       return errorCodeToError(EC);




More information about the llvm-commits mailing list