Attempt to fix the test failures observed in CI: * Add Option dependency, which caused BUILD_SHARED_LIBS builds to fail * Adapt tests that accidentally depended on the host platform: platforms that don't use an integrated assembler (e.g. AIX) get a different set of commands from the driver. Most dependency scanner tests can use -fsyntax-only or -E instead of -c to avoid this, and in the rare case we want to check -c specifically, set an explicit target so the behaviour is independent of the host. Original commit message follows. --- Instead of trying to "fix" the original driver invocation by appending arguments to it, split it into multiple commands, and for each -cc1 command use a CompilerInvocation to give precise control over the invocation. This change should make it easier to (in the future) canonicalize the command-line (e.g. to improve hits in something like ccache), apply optimizations, or start supporting multi-arch builds, which would require different modules for each arch. In the long run it may make sense to treat the TU commands as a dependency graph, each with their own dependencies on modules or earlier TU commands, but for now they are simply a list that is executed in order, and the dependencies are simply duplicated. Since we currently only support single-arch builds, there is no parallelism available in the execution. Differential Revision: https://reviews.llvm.org/D132405
47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
// 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: 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
|
|
|
|
// Check that the '-Wno-error=invalid-ios-deployment-target' option is being
|
|
// respected and invalid arguments like '-target i386-apple-ios14.0-simulator'
|
|
// do not result in an error.
|
|
|
|
// CHECK-NOT: error:
|
|
// CHECK: {
|
|
// 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: "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-NOT: "-fimplicit-modules"
|
|
// CHECK-NOT: "-fimplicit-module-maps"
|
|
// CHECK: ],
|
|
// CHECK: "file-deps": [
|
|
// CHECK-NEXT: "[[PREFIX]]/tu.c"
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"
|
|
// CHECK-NEXT: }
|