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

NAKAMURA Takumi geek4civic at gmail.com
Tue Oct 15 18:42:33 PDT 2013


Author: chapuni
Date: Tue Oct 15 20:42:33 2013
New Revision: 192763

URL: http://llvm.org/viewvc/llvm-project?rev=192763&view=rev
Log:
clang-tools-extra/modularize: Compare Paths to Prefix as natively-canonicalized form.

On Win32, paths are not expected to be canonicalized.

Modified:
    clang-tools-extra/trunk/modularize/ModuleAssistant.cpp

Modified: clang-tools-extra/trunk/modularize/ModuleAssistant.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/ModuleAssistant.cpp?rev=192763&r1=192762&r2=192763&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/ModuleAssistant.cpp (original)
+++ clang-tools-extra/trunk/modularize/ModuleAssistant.cpp Tue Oct 15 20:42:33 2013
@@ -162,8 +162,12 @@ static bool addModuleDescription(Module
   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();





More information about the cfe-commits mailing list