[clang-scan-deps] remove dots and dots dots from the reported file dependency paths

This resolves differences observed on LLVM + Clang when running the comparison between canonical
dependencies (full preprocessing, no file manager reused), and dependencies obtained
when the file manager was reused between the full preprocessing invocations.

llvm-svn: 371751
This commit is contained in:
Alex Lorenz 2019-09-12 18:03:24 +00:00
parent 458c2759b1
commit 57a014d31f
2 changed files with 7 additions and 3 deletions

View File

@ -30,8 +30,12 @@ public:
: DependencyFileGenerator(*Opts), Opts(std::move(Opts)), C(C) {}
void finishedMainFile(DiagnosticsEngine &Diags) override {
for (const auto &File : getDependencies())
C.handleFileDependency(*Opts, File);
llvm::SmallString<256> CanonPath;
for (const auto &File : getDependencies()) {
CanonPath = File;
llvm::sys::path::remove_dots(CanonPath, /*remove_dot_dot=*/true);
C.handleFileDependency(*Opts, CanonPath);
}
}
private:

View File

@ -6,7 +6,7 @@
},
{
"directory": "DIR",
"command": "clang -E DIR/subframework_header_dir_symlink_input2.m -FInputs/frameworks -iframework Inputs/frameworks_symlink",
"command": "clang -E DIR/subframework_header_dir_symlink_input2.m -FInputs/frameworks -iframework Inputs/frameworks_symlink/../frameworks_symlink",
"file": "DIR/subframework_header_dir_symlink_input2.m"
}
]