forked from apple/llvm-project
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][deps] Test diagnostic options are being respected
This patch tests code in D108976. This split is necessary to avoid temporary regression. Depends on D108974, Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D109158
- Loading branch information
1 parent
993f60a
commit 7afabc2
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/cdb.json.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] |
Empty file.
1 change: 1 addition & 0 deletions
1
llvm/clang/test/ClangScanDeps/Inputs/diagnostics/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module mod { header "mod.h" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "mod.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: } |