clang-tools-extra/modularize: Compare Paths to Prefix as natively-canonicalized form.
On Win32, paths are not expected to be canonicalized.
llvm-svn: 192763
diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp
index 45641cb..36e899a 100644
--- a/clang-tools-extra/modularize/ModuleAssistant.cpp
+++ b/clang-tools-extra/modularize/ModuleAssistant.cpp
@@ -162,8 +162,12 @@
DependentsVector &FileDependents = Dependencies[HeaderFilePath];
std::string FilePath;
// Strip prefix.
- if (HeaderFilePath.startswith(HeaderPrefix))
- FilePath = HeaderFilePath.substr(HeaderPrefix.size() + 1);
+ // HeaderFilePath should be compared to natively-canonicalized Prefix.
+ llvm::SmallString<256> NativePath, NativePrefix;
+ llvm::sys::path::native(HeaderFilePath, NativePath);
+ llvm::sys::path::native(HeaderPrefix, NativePrefix);
+ if (NativePath.startswith(NativePrefix))
+ FilePath = NativePath.substr(NativePrefix.size() + 1);
else
FilePath = HeaderFilePath;
int Count = FileDependents.size();