[PATCH] D109158: [clang][deps] Test diagnostic options are being respected
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 10 05:48:28 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7afabc2e4e86: [clang][deps] Test diagnostic options are being respected (authored by jansvoboda11).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D109158?vs=370271&id=371901#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109158/new/
https://reviews.llvm.org/D109158
Files:
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/mod.h
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c
llvm/clang/test/ClangScanDeps/diagnostics.c
Index: llvm/clang/test/ClangScanDeps/diagnostics.c
===================================================================
--- /dev/null
+++ llvm/clang/test/ClangScanDeps/diagnostics.c
@@ -0,0 +1,49 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: cp %S/Inputs/diagnostics/* %t
+
+// RUN: sed "s|DIR|%/t|g" %S/Inputs/diagnostics/cdb.json.template > %t/cdb.json
+// RUN: echo -%t > %t/result.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
+
+// Check that the scanner injects '-Wno-error' option and invalid command-line
+// arguments like '-target i386-apple-ios14.0-simulator' do not result in error.
+
+// CHECK-NOT: error:
+// CHECK: -[[PREFIX:.*]]
+// CHECK-NEXT: {
+// CHECK-NEXT: "modules": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "clang-module-deps": [],
+// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
+// CHECK-NEXT: "command-line": [
+// CHECK-NEXT: "-cc1"
+// CHECK: ],
+// CHECK-NEXT: "context-hash": "[[HASH_MOD:.*]]",
+// CHECK-NEXT: "file-deps": [
+// CHECK-NEXT: "[[PREFIX]]/mod.h"
+// CHECK-NEXT: "[[PREFIX]]/module.modulemap"
+// CHECK-NEXT: ],
+// CHECK-NEXT: "name": "mod"
+// CHECK-NEXT: }
+// CHECK-NEXT: ],
+// CHECK-NEXT: "translation-units": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "clang-context-hash": "[[HASH_TU:.*]],
+// CHECK-NEXT: "clang-module-deps": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "context-hash": "[[HASH_MOD]]",
+// CHECK-NEXT: "module-name": "mod"
+// CHECK-NEXT: }
+// CHECK-NEXT: ],
+// CHECK-NEXT: "command-line": [
+// CHECK-NEXT: "-fno-implicit-modules"
+// CHECK-NEXT: "-fno-implicit-module-maps"
+// CHECK-NEXT: ],
+// CHECK-NEXT: "file-deps": [
+// CHECK-NEXT: "[[PREFIX]]/tu.c"
+// CHECK-NEXT: ],
+// CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
+// CHECK-NEXT: }
Index: llvm/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c
===================================================================
--- /dev/null
+++ llvm/clang/test/ClangScanDeps/Inputs/diagnostics/tu.c
@@ -0,0 +1 @@
+#include "mod.h"
Index: llvm/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
===================================================================
--- /dev/null
+++ llvm/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
@@ -0,0 +1 @@
+module mod { header "mod.h" }
Index: llvm/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
===================================================================
--- /dev/null
+++ llvm/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
@@ -0,0 +1,7 @@
+[
+ {
+ "directory": "DIR",
+ "command": "clang -c DIR/tu.c -fmodules -target i386-apple-ios14.0-simulator -o DIR/tu.o",
+ "file": "DIR/tu.c"
+ }
+]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109158.371901.patch
Type: text/x-patch
Size: 3005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210910/1a70336e/attachment.bin>
More information about the cfe-commits
mailing list