1 // Check that the scanner produces raw ast files, even when builds produce the
2 // obj format, and that the scanner can read obj format from PCH and modules
5 // Unsupported on AIX because we don't support the requisite "__clangast"
6 // section in XCOFF yet.
7 // UNSUPPORTED: target={{.*}}-aix{{.*}}
11 // RUN: rm -rf %t && mkdir %t
12 // RUN: cp %S/Inputs/modules-pch/* %t
14 // Scan dependencies of the PCH:
16 // RUN: rm -f %t/cdb_pch.json
17 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb_pch.json
18 // RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \
19 // RUN: -module-files-dir %t/build -o %t/result_pch.json
21 // Explicitly build the PCH:
23 // RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon1 > %t/mod_common_1.cc1.rsp
24 // RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon2 > %t/mod_common_2.cc1.rsp
25 // RUN: %deps-to-rsp %t/result_pch.json --module-name=ModPCH > %t/mod_pch.cc1.rsp
26 // RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp
28 // RUN: %clang @%t/mod_common_1.cc1.rsp
29 // RUN: %clang @%t/mod_common_2.cc1.rsp
30 // RUN: %clang @%t/mod_pch.cc1.rsp
31 // RUN: %clang @%t/pch.rsp
33 // Scan dependencies of the TU:
35 // RUN: rm -f %t/cdb_tu.json
36 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb_tu.json
37 // RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \
38 // RUN: -module-files-dir %t/build > %t/result_tu.json
40 // Explicitly build the TU:
42 // RUN: %deps-to-rsp %t/result_tu.json --module-name=ModTU > %t/mod_tu.cc1.rsp
43 // RUN: %deps-to-rsp %t/result_tu.json --tu-index=0 > %t/tu.rsp
45 // RUN: %clang @%t/mod_tu.cc1.rsp
46 // RUN: %clang @%t/tu.rsp
48 // Check the module format for scanner modules:
50 // RUN: find %t/cache -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=SCAN
51 // SCAN: Module format: raw
52 // SCAN: Module format: raw
53 // SCAN: Module format: raw
54 // SCAN: Module format: raw
56 // Check the module format for built modules:
58 // RUN: find %t/build -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=BUILD
59 // BUILD: Module format: obj
60 // BUILD: Module format: obj
61 // BUILD: Module format: obj
62 // BUILD: Module format: obj
64 // FIXME: check pch format as well; -module-file-info does not work with a PCH