63 lines · c
1// Check that the scanner produces raw ast files, even when builds produce the2// obj format, and that the scanner can read obj format from PCH and modules3// 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 %t10// RUN: cp %S/Inputs/modules-pch/* %t11 12// Scan dependencies of the PCH:13//14// RUN: rm -f %t/cdb_pch.json15// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb_pch.json16// RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \17// RUN: -module-files-dir %t/build -o %t/result_pch.json18 19// Explicitly build the PCH:20//21// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon1 > %t/mod_common_1.cc1.rsp22// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon2 > %t/mod_common_2.cc1.rsp23// RUN: %deps-to-rsp %t/result_pch.json --module-name=ModPCH > %t/mod_pch.cc1.rsp24// RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp25//26// RUN: %clang @%t/mod_common_1.cc1.rsp27// RUN: %clang @%t/mod_common_2.cc1.rsp28// RUN: %clang @%t/mod_pch.cc1.rsp29// RUN: %clang @%t/pch.rsp30 31// Scan dependencies of the TU:32//33// RUN: rm -f %t/cdb_tu.json34// RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb_tu.json35// RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \36// RUN: -module-files-dir %t/build > %t/result_tu.json37 38// Explicitly build the TU:39//40// RUN: %deps-to-rsp %t/result_tu.json --module-name=ModTU > %t/mod_tu.cc1.rsp41// RUN: %deps-to-rsp %t/result_tu.json --tu-index=0 > %t/tu.rsp42//43// RUN: %clang @%t/mod_tu.cc1.rsp44// RUN: %clang @%t/tu.rsp45 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=SCAN49// SCAN: Module format: raw50// SCAN: Module format: raw51// SCAN: Module format: raw52// SCAN: Module format: raw53 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=BUILD57// BUILD: Module format: obj58// BUILD: Module format: obj59// BUILD: Module format: obj60// BUILD: Module format: obj61 62// FIXME: check pch format as well; -module-file-info does not work with a PCH63