87 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4 5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cpp -o %t/a.pcm6 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cpp \8// RUN: -fmodule-file=a=%t/a.pcm -o %t/c.pcm9 10// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/d.cpp \11// RUN: -fmodule-file=a=%t/a.pcm -o %t/d.pcm12 13// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/e.cpp \14// RUN: -fmodule-file=a=%t/a.pcm -o %t/e.pcm15 16// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a-part.cpp \17// RUN: -o %t/a-part.pcm18 19// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/f.cpp \20// RUN: -fmodule-file=a=%t/a.pcm -o %t/f.pcm -verify21 22// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/g.cpp \23// RUN: -fmodule-file=a=%t/a.pcm -o %t/g.pcm -verify24 25// Test again with reduced BMI.26// RUN: rm -rf %t27// RUN: mkdir -p %t28// RUN: split-file %s %t29 30// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cpp -o %t/a.pcm31 32// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/c.cpp \33// RUN: -fmodule-file=a=%t/a.pcm -o %t/c.pcm34 35// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/d.cpp \36// RUN: -fmodule-file=a=%t/a.pcm -o %t/d.pcm37 38// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/e.cpp \39// RUN: -fmodule-file=a=%t/a.pcm -o %t/e.pcm40 41// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a-part.cpp \42// RUN: -o %t/a-part.pcm43 44// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/f.cpp \45// RUN: -fmodule-file=a=%t/a.pcm -o %t/f.pcm -verify46 47// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/g.cpp \48// RUN: -fmodule-file=a=%t/a.pcm -o %t/g.pcm -verify49 50//--- a.cpp51export module a;52 53//--- b.hpp54import a;55 56//--- c.cpp57module;58#include "b.hpp"59export module c;60 61//--- d.cpp62module;63import a;64 65export module d;66 67//--- e.cpp68export module e;69 70module :private;71import a;72 73//--- a-part.cpp74export module a:part;75 76//--- f.cpp77module;78import :part ; // expected-error {{module partition imports cannot be in the global module fragment}}79 80export module f;81 82//--- g.cpp83 84export module g;85module :private;86import :part; // expected-error {{module partition imports cannot be in the private module fragment}}87