140 lines · c
1// Unsupported on AIX because we don't support the requisite "__clangast"2// section in XCOFF yet.3// UNSUPPORTED: target={{.*}}-aix{{.*}}4 5// This test checks that the dependency scanner can handle larger amount of6// explicitly built modules retrieved from the PCH.7// (Previously, there was a bug dangling iterator bug that manifested only with8// 16 and more retrieved modules.)9 10// RUN: rm -rf %t11// RUN: split-file %s %t12 13//--- mod_00.h14//--- mod_01.h15//--- mod_02.h16//--- mod_03.h17//--- mod_04.h18//--- mod_05.h19//--- mod_06.h20//--- mod_07.h21//--- mod_08.h22//--- mod_09.h23//--- mod_10.h24//--- mod_11.h25//--- mod_12.h26//--- mod_13.h27//--- mod_14.h28//--- mod_15.h29//--- mod_16.h30//--- mod.h31#include "mod_00.h"32#include "mod_01.h"33#include "mod_02.h"34#include "mod_03.h"35#include "mod_04.h"36#include "mod_05.h"37#include "mod_06.h"38#include "mod_07.h"39#include "mod_08.h"40#include "mod_09.h"41#include "mod_10.h"42#include "mod_11.h"43#include "mod_12.h"44#include "mod_13.h"45#include "mod_14.h"46#include "mod_15.h"47#include "mod_16.h"48//--- module.modulemap49module mod_00 { header "mod_00.h" }50module mod_01 { header "mod_01.h" }51module mod_02 { header "mod_02.h" }52module mod_03 { header "mod_03.h" }53module mod_04 { header "mod_04.h" }54module mod_05 { header "mod_05.h" }55module mod_06 { header "mod_06.h" }56module mod_07 { header "mod_07.h" }57module mod_08 { header "mod_08.h" }58module mod_09 { header "mod_09.h" }59module mod_10 { header "mod_10.h" }60module mod_11 { header "mod_11.h" }61module mod_12 { header "mod_12.h" }62module mod_13 { header "mod_13.h" }63module mod_14 { header "mod_14.h" }64module mod_15 { header "mod_15.h" }65module mod_16 { header "mod_16.h" }66module mod { header "mod.h" }67 68//--- pch.h69#include "mod.h"70 71//--- tu.c72 73//--- cdb_pch.json.template74[{75 "file": "DIR/pch.h",76 "directory": "DIR",77 "command": "clang -x c-header DIR/pch.h -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -o DIR/pch.h.gch"78}]79 80//--- cdb_tu.json.template81[{82 "file": "DIR/tu.c",83 "directory": "DIR",84 "command": "clang -fsyntax-only DIR/tu.c -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -include DIR/pch.h -o DIR/tu.o"85}]86 87// Scan dependencies of the PCH:88//89// RUN: sed "s|DIR|%/t|g" %t/cdb_pch.json.template > %t/cdb_pch.json90// RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \91// RUN: -module-files-dir %t/build > %t/result_pch.json92 93// Explicitly build the PCH:94//95// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_00 > %t/mod_00.cc1.rsp96// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_01 > %t/mod_01.cc1.rsp97// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_02 > %t/mod_02.cc1.rsp98// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_03 > %t/mod_03.cc1.rsp99// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_04 > %t/mod_04.cc1.rsp100// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_05 > %t/mod_05.cc1.rsp101// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_06 > %t/mod_06.cc1.rsp102// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_07 > %t/mod_07.cc1.rsp103// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_08 > %t/mod_08.cc1.rsp104// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_09 > %t/mod_09.cc1.rsp105// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_10 > %t/mod_10.cc1.rsp106// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_11 > %t/mod_11.cc1.rsp107// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_12 > %t/mod_12.cc1.rsp108// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_13 > %t/mod_13.cc1.rsp109// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_14 > %t/mod_14.cc1.rsp110// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_15 > %t/mod_15.cc1.rsp111// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod_16 > %t/mod_16.cc1.rsp112// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod > %t/mod.cc1.rsp113// RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp114//115// RUN: %clang @%t/mod_00.cc1.rsp116// RUN: %clang @%t/mod_01.cc1.rsp117// RUN: %clang @%t/mod_02.cc1.rsp118// RUN: %clang @%t/mod_03.cc1.rsp119// RUN: %clang @%t/mod_04.cc1.rsp120// RUN: %clang @%t/mod_05.cc1.rsp121// RUN: %clang @%t/mod_06.cc1.rsp122// RUN: %clang @%t/mod_07.cc1.rsp123// RUN: %clang @%t/mod_08.cc1.rsp124// RUN: %clang @%t/mod_09.cc1.rsp125// RUN: %clang @%t/mod_10.cc1.rsp126// RUN: %clang @%t/mod_11.cc1.rsp127// RUN: %clang @%t/mod_12.cc1.rsp128// RUN: %clang @%t/mod_13.cc1.rsp129// RUN: %clang @%t/mod_14.cc1.rsp130// RUN: %clang @%t/mod_15.cc1.rsp131// RUN: %clang @%t/mod_16.cc1.rsp132// RUN: %clang @%t/mod.cc1.rsp133// RUN: %clang @%t/pch.rsp134 135// Scan dependencies of the TU, checking it doesn't crash:136//137// RUN: sed "s|DIR|%/t|g" %t/cdb_tu.json.template > %t/cdb_tu.json138// RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \139// RUN: -module-files-dir %t/build140