64 lines · cpp
1// Tests mixed usage of precompiled headers and modules.2//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 -x c++-header -emit-pch %t/a.hpp \8// RUN: -o %t/a.pch9 10// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Part1.cppm \11// RUN: -include-pch %t/a.pch -o %t/Part1.pcm12// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Part2.cppm \13// RUN: -include-pch %t/a.pch -o %t/Part2.pcm14// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Part3.cppm \15// RUN: -include-pch %t/a.pch -o %t/Part3.pcm16// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Part4.cppm \17// RUN: -include-pch %t/a.pch -o %t/Part4.pcm18 19// RUN: %clang_cc1 -std=c++20 -emit-module-interface \20// RUN: -fmodule-file=mod:part1=%t/Part1.pcm \21// RUN: -fmodule-file=mod:part2=%t/Part2.pcm \22// RUN: -fmodule-file=mod:part3=%t/Part3.pcm \23// RUN: -fmodule-file=mod:part4=%t/Part4.pcm \24// RUN: %t/Mod.cppm \25// RUN: -include-pch %t/a.pch -o %t/Mod.pcm26 27// RUN: %clang_cc1 -std=c++20 -emit-obj \28// RUN: -main-file-name Mod.cppm \29// RUN: -fmodule-file=mod:part1=%t/Part1.pcm \30// RUN: -fmodule-file=mod:part2=%t/Part2.pcm \31// RUN: -fmodule-file=mod:part3=%t/Part3.pcm \32// RUN: -fmodule-file=mod:part4=%t/Part4.pcm \33// RUN: -x pcm %t/Mod.pcm \34// RUN: -include-pch %t/a.pch -o %t/Mod.o35 36 37//--- a.hpp38#pragma once39 40class a {41 virtual ~a();42 a() {}43};44 45//--- Part1.cppm46export module mod:part1;47 48//--- Part2.cppm49export module mod:part2;50 51//--- Part3.cppm52export module mod:part3;53 54//--- Part4.cppm55export module mod:part4;56 57//--- Mod.cppm58export module mod;59export import :part1;60export import :part2;61export import :part3;62export import :part4;63 64