[dwarfdump] Normalize input path.

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
This commit is contained in:
Jonas Devlieghere 2018-02-08 16:31:01 +00:00
parent de0e359a34
commit bce345d61d

View 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") {