clang-tools-extra/modularize: Compare Paths to Prefix as natively-canonicalized form.

On Win32, paths are not expected to be canonicalized.

llvm-svn: 192763
This commit is contained in:
NAKAMURA Takumi 2013-10-16 01:42:33 +00:00
parent 002667c32b
commit bf5391d2ef
1 changed files with 6 additions and 2 deletions

View File

@ -162,8 +162,12 @@ static bool addModuleDescription(Module *RootModule,
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();