1 // Unsupported on AIX because we don't support the requisite "__clangast"
2 // section in XCOFF yet.
3 // UNSUPPORTED: target={{.*}}-aix{{.*}}
5 // RUN: rm -rf %t && mkdir %t
6 // RUN: split-file %s %t
8 //--- undeclared/module.modulemap
9 module Undeclared
{ header
"undeclared.h" }
11 //--- undeclared/undeclared.h
13 //--- module.modulemap
14 module User
[no_undeclared_includes
] { header
"user.h" }
17 #if __has_include("undeclared.h")
18 #error Unreachable. Undeclared comes from a module that's not 'use'd, meaning the compiler should pretend it doesn't exist.
24 //--- cdb.json.template
27 "command": "clang -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -IDIR/undeclared -c DIR/test.c -o DIR/test.o",
31 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
32 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
33 // RUN: -module-files-dir %t/build > %t/result.json
34 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
37 // CHECK-NEXT: "modules": [
39 // CHECK-NEXT: "clang-module-deps": [],
40 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
41 // CHECK-NEXT: "command-line": [
42 // CHECK: "-fmodule-map-file=[[PREFIX]]/undeclared/module.modulemap"
44 // CHECK-NEXT: "context-hash": "{{.*}}",
45 // CHECK-NEXT: "file-deps": [
46 // CHECK-NEXT: "[[PREFIX]]/module.modulemap",
47 // CHECK-NEXT: "[[PREFIX]]/undeclared/module.modulemap",
48 // CHECK-NEXT: "[[PREFIX]]/user.h"
50 // CHECK-NEXT: "name": "User"
53 // CHECK-NEXT: "translation-units": [
55 // CHECK: "clang-context-hash": "{{.*}}"
56 // CHECK-NEXT: "clang-module-deps": [
58 // CHECK-NEXT: "context-hash": "{{.*}}"
59 // CHECK-NEXT: "module-name": "User"
62 // CHECK-NEXT: "command-line": [
64 // CHECK: "file-deps": [
65 // CHECK-NEXT: "[[PREFIX]]/test.c"
67 // CHECK-NEXT: "input-file": "[[PREFIX]]/test.c"
70 // RUN: %deps-to-rsp %t/result.json --module-name=User > %t/User.cc1.rsp
71 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
73 // RUN: %clang @%t/User.cc1.rsp
74 // RUN: %clang @%t/tu.rsp