| 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 |
| 3 |
// imported by PCH. |
| 4 |
|
| 5 |
// Unsupported on AIX because we don't support the requisite "__clangast" |
| 6 |
// section in XCOFF yet. |
| 7 |
// UNSUPPORTED: target={{.*}}-aix{{.*}} |
| 8 |
|
| 9 |
// RUN: rm -rf %t && mkdir %t |
| 10 |
// RUN: cp %S/Inputs/modules-pch/* %t |
| 11 |
|
| 12 |
// Scan dependencies of the PCH: |
| 13 |
// |
| 14 |
// RUN: rm -f %t/cdb_pch.json |
| 15 |
// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb_pch.json |
| 16 |
// RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \ |
| 17 |
// RUN: -module-files-dir %t/build -o %t/result_pch.json |
| 18 |
|
| 19 |
// Explicitly build the PCH: |
| 20 |
// |
| 21 |
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon1 > %t/mod_common_1.cc1.rsp |
| 22 |
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon2 > %t/mod_common_2.cc1.rsp |
| 23 |
// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModPCH > %t/mod_pch.cc1.rsp |
| 24 |
// RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp |
| 25 |
// |
| 26 |
// RUN: %clang @%t/mod_common_1.cc1.rsp |
| 27 |
// RUN: %clang @%t/mod_common_2.cc1.rsp |
| 28 |
// RUN: %clang @%t/mod_pch.cc1.rsp |
| 29 |
// RUN: %clang @%t/pch.rsp |
| 30 |
|
| 31 |
// Scan dependencies of the TU: |
| 32 |
// |
| 33 |
// RUN: rm -f %t/cdb_tu.json |
| 34 |
// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb_tu.json |
| 35 |
// RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \ |
| 36 |
// RUN: -module-files-dir %t/build > %t/result_tu.json |
| 37 |
|
| 38 |
// Explicitly build the TU: |
| 39 |
// |
| 40 |
// RUN: %deps-to-rsp %t/result_tu.json --module-name=ModTU > %t/mod_tu.cc1.rsp |
| 41 |
// RUN: %deps-to-rsp %t/result_tu.json --tu-index=0 > %t/tu.rsp |
| 42 |
// |
| 43 |
// RUN: %clang @%t/mod_tu.cc1.rsp |
| 44 |
// RUN: %clang @%t/tu.rsp |
| 45 |
|
| 46 |
// Check the module format for scanner modules: |
| 47 |
// |
| 48 |
// RUN: find %t/cache -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=SCAN |
| 49 |
// SCAN: Module format: raw |
| 50 |
// SCAN: Module format: raw |
| 51 |
// SCAN: Module format: raw |
| 52 |
// SCAN: Module format: raw |
| 53 |
|
| 54 |
// Check the module format for built modules: |
| 55 |
// |
| 56 |
// RUN: find %t/build -name "*.pcm" -exec %clang_cc1 -module-file-info "{}" ";" | FileCheck %s -check-prefix=BUILD |
| 57 |
// BUILD: Module format: obj |
| 58 |
// BUILD: Module format: obj |
| 59 |
// BUILD: Module format: obj |
| 60 |
// BUILD: Module format: obj |
| 61 |
|
| 62 |
// FIXME: check pch format as well; -module-file-info does not work with a PCH |