[clang] ef1b22a - [clang][ClangScanDeps][test] Remove the file before overwriting it

Dmitri Gribenko via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 04:52:09 PDT 2023


Author: Dmitri Gribenko
Date: 2023-04-06T13:51:57+02:00
New Revision: ef1b22a20fd4d8c0cfea64089d4e732dd95dc265

URL: https://github.com/llvm/llvm-project/commit/ef1b22a20fd4d8c0cfea64089d4e732dd95dc265
DIFF: https://github.com/llvm/llvm-project/commit/ef1b22a20fd4d8c0cfea64089d4e732dd95dc265.diff

LOG: [clang][ClangScanDeps][test] Remove the file before overwriting it

Remove the file copied from the source tree before overwriting it. If
the source code is stored with readonly (0444) permissions, then
the copied files are also readonly and attempting to overwrite them
fails.

Added: 
    

Modified: 
    clang/test/ClangScanDeps/modules-pch.c

Removed: 
    


################################################################################
diff  --git a/clang/test/ClangScanDeps/modules-pch.c b/clang/test/ClangScanDeps/modules-pch.c
index aa568e5aaab4d..0f61dd5ecf18c 100644
--- a/clang/test/ClangScanDeps/modules-pch.c
+++ b/clang/test/ClangScanDeps/modules-pch.c
@@ -7,6 +7,7 @@
 
 // Scan dependencies of the PCH:
 //
+// RUN: rm -f %t/cdb_pch.json
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb_pch.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \
 // RUN:   -module-files-dir %t/build > %t/result_pch.json
@@ -94,6 +95,7 @@
 
 // Scan dependencies of the TU:
 //
+// RUN: rm -f %t/cdb_tu.json
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb_tu.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \
 // RUN:   -module-files-dir %t/build > %t/result_tu.json
@@ -142,6 +144,7 @@
 
 // Scan dependencies of the TU that has common modules with the PCH:
 //
+// RUN: rm -f %t/cdb_tu_with_common.json
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu_with_common.json > %t/cdb_tu_with_common.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_tu_with_common.json -format experimental-full \
 // RUN:   -module-files-dir %t/build > %t/result_tu_with_common.json


        


More information about the cfe-commits mailing list