[dwarfdump] Normalize input path.
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 8 Feb 2018 16:31:01 +0000 (16:31 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 8 Feb 2018 16:31:01 +0000 (16:31 +0000)
Before this patch, llvm-dwarfdump would reject `bundel.dSYM/` as input,
while `bundel.dSYM` was accepted. The reason is that `path::extension()`
returns an empty string for the former, leading to the argument not
being recognized as a dSYM bundle.

llvm-svn: 324621

llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

index 2149377..f2a837d 100644 (file)
@@ -478,6 +478,8 @@ static bool handleFile(StringRef Filename, HandlerFn HandleObj,
 static std::vector<std::string> expandBundle(const std::string &InputPath) {
   std::vector<std::string> BundlePaths;
   SmallString<256> BundlePath(InputPath);
+  // Normalize input path. This is necessary to accept `bundle.dSYM/`.
+  sys::path::remove_dots(BundlePath);
   // Manually open up the bundle to avoid introducing additional dependencies.
   if (sys::fs::is_directory(BundlePath) &&
       sys::path::extension(BundlePath) == ".dSYM") {