summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ModuleDependencyCollector.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-12-12 23:12:27 +0000
committerJustin Bogner <mail@justinbogner.com>2014-12-12 23:12:27 +0000
commit93e3cfcf9906b8eac682844af2d040a4f086b711 (patch)
tree7cb18d2b8eee4d0b4d946ec509fa667cc2ccc1a6 /clang/lib/Frontend/ModuleDependencyCollector.cpp
parentbfd53cd2afc8533c9d21fb328574155b496ced2f (diff)
downloadbcm5719-llvm-93e3cfcf9906b8eac682844af2d040a4f086b711.tar.gz
bcm5719-llvm-93e3cfcf9906b8eac682844af2d040a4f086b711.zip
Frontend: Canonicalize to native paths when dumping module dependencies
Mixed path separators (ie, both / and \\) can mess up the sort order of the VFS map when dumping module dependencies, as was recently exposed by r224055 and papered over in r224145. Instead, we should simply use native paths for consistency. This also adds a TODO to add handling of .. in paths. There was some code for this before r224055, but it was untested and probably broken. llvm-svn: 224164
Diffstat (limited to 'clang/lib/Frontend/ModuleDependencyCollector.cpp')
-rw-r--r--clang/lib/Frontend/ModuleDependencyCollector.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/ModuleDependencyCollector.cpp b/clang/lib/Frontend/ModuleDependencyCollector.cpp
index 1ac7e36eff1..8e2ee55bcaa 100644
--- a/clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ b/clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -63,6 +63,10 @@ std::error_code ModuleDependencyListener::copyToRoot(StringRef Src) {
// We need an absolute path to append to the root.
SmallString<256> AbsoluteSrc = Src;
fs::make_absolute(AbsoluteSrc);
+ // Canonicalize to a native path to avoid mixed separator styles.
+ path::native(AbsoluteSrc);
+ // TODO: We probably need to handle .. as well as . in order to have valid
+ // input to the YAMLVFSWriter.
FileManager::removeDotPaths(AbsoluteSrc);
// Build the destination path.
OpenPOWER on IntegriCloud