[clang] 2d1e46f - [clang][deps] NFC: Convert test to split-file

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 10:44:35 PDT 2023


Author: Jan Svoboda
Date: 2023-08-01T10:44:30-07:00
New Revision: 2d1e46fec6dbc6c4ecdf1354c091d01bc8267158

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

LOG: [clang][deps] NFC: Convert test to split-file

Added: 
    

Modified: 
    clang/test/ClangScanDeps/diagnostics.c

Removed: 
    clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
    clang/test/ClangScanDeps/Inputs/diagnostics/mod.h
    clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
    clang/test/ClangScanDeps/Inputs/diagnostics/tu.c


################################################################################
diff  --git a/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template b/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
deleted file mode 100644
index c729ea980a64d3..00000000000000
--- a/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
+++ /dev/null
@@ -1,7 +0,0 @@
-[
-  {
-    "directory": "DIR",
-    "command": "clang -c DIR/tu.c -fmodules -target i386-apple-ios14.0-simulator -fmodules-cache-path=DIR/cache -Wno-error=invalid-ios-deployment-target -o DIR/tu.o",
-    "file": "DIR/tu.c"
-  }
-]

diff  --git a/clang/test/ClangScanDeps/Inputs/diagnostics/mod.h b/clang/test/ClangScanDeps/Inputs/diagnostics/mod.h
deleted file mode 100644
index e69de29bb2d1d6..00000000000000

diff  --git a/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap b/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
deleted file mode 100644
index 03cbffaeb1fb52..00000000000000
--- a/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
+++ /dev/null
@@ -1 +0,0 @@
-module mod { header "mod.h" }

diff  --git a/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c b/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c
deleted file mode 100644
index 01f145835c7653..00000000000000
--- a/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "mod.h"

diff  --git a/clang/test/ClangScanDeps/diagnostics.c b/clang/test/ClangScanDeps/diagnostics.c
index b5ca499192a2a4..42aeca16cddc44 100644
--- a/clang/test/ClangScanDeps/diagnostics.c
+++ b/clang/test/ClangScanDeps/diagnostics.c
@@ -1,7 +1,21 @@
-// RUN: rm -rf %t && mkdir %t
-// RUN: cp %S/Inputs/diagnostics/* %t
+// RUN: rm -rf %t
+// RUN: split-file %s %t
 
-// RUN: sed "s|DIR|%/t|g" %S/Inputs/diagnostics/cdb.json.template > %t/cdb.json
+//--- cdb.json.template
+[
+  {
+    "directory": "DIR",
+    "command": "clang -c DIR/tu.c -fmodules -target i386-apple-ios14.0-simulator -fmodules-cache-path=DIR/cache -Wno-error=invalid-ios-deployment-target -o DIR/tu.o",
+    "file": "DIR/tu.c"
+  }
+]
+//--- mod.h
+//--- module.modulemap
+module mod { header "mod.h" }
+//--- tu.c
+#include "mod.h"
+
+// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full 2>&1 > %t/result.json
 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
 


        


More information about the cfe-commits mailing list