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

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 11:03:24 PDT 2019


Author: arphaman
Date: Thu Sep 12 11:03:24 2019
New Revision: 371751

URL: http://llvm.org/viewvc/llvm-project?rev=371751&view=rev
Log:
[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.

Modified:
    cfe/trunk/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json

Modified: cfe/trunk/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp?rev=371751&r1=371750&r2=371751&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (original)
+++ cfe/trunk/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp Thu Sep 12 11:03:24 2019
@@ -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:

Modified: cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json?rev=371751&r1=371750&r2=371751&view=diff
==============================================================================
--- cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json (original)
+++ cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json Thu Sep 12 11:03:24 2019
@@ -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"
 }
 ]




More information about the cfe-commits mailing list