brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · ffbc5fd Raw
121 lines · plain
1// Test case from https://github.com/llvm/llvm-project/issues/600362//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm8// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/b.pcm9// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/c.pcm10// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/d.pcm11// RUN: %clang_cc1 -std=c++20 %t/e.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/e.pcm12// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/f.pcm13// RUN: %clang_cc1 -std=c++20 %t/g.cppm -fprebuilt-module-path=%t -verify -fsyntax-only 14//15// Tests that the behavior is fine with specifying module file with `-fmodule-file`.16// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm17// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/b.pcm18// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/c.pcm19// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface  -o %t/d.pcm20// RUN: %clang_cc1 -std=c++20 %t/e.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \21// RUN:		-fmodule-file=c=%t/c.pcm -fmodule-file=d=%t/d.pcm -o %t/e.pcm22// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fmodule-file=c=%t/c.pcm -fmodule-file=d=%t/d.pcm -o %t/f.pcm23// RUN: %clang_cc1 -std=c++20 %t/g.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \24// RUN:		-fmodule-file=c=%t/c.pcm -fmodule-file=d=%t/d.pcm -fmodule-file=e=%t/e.pcm \25// RUN:		-fmodule-file=f=%t/f.pcm -verify -fsyntax-only 26 27// Test again with reduced BMI28// RUN: rm -rf %t29// RUN: mkdir -p %t30// RUN: split-file %s %t31//32// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm33// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -fprebuilt-module-path=%t -o %t/b.pcm34// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -fprebuilt-module-path=%t -o %t/c.pcm35// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-reduced-module-interface -fprebuilt-module-path=%t -o %t/d.pcm36// RUN: %clang_cc1 -std=c++20 %t/e.cppm -emit-reduced-module-interface -fprebuilt-module-path=%t -o %t/e.pcm37// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-reduced-module-interface -fprebuilt-module-path=%t -o %t/f.pcm38// RUN: %clang_cc1 -std=c++20 %t/g.cppm -fprebuilt-module-path=%t -verify -fsyntax-only 39 40 41//--- a.cppm42export module a;43 44export template<typename>45struct a;46 47template<typename T>48struct a<T &> {49	using type = char;50};51 52//--- b.cppm53export module b;54 55import a;56 57typename a<char &>::type;58 59//--- c.cppm60export module c;61 62import a;63 64typename a<char &>::type;65 66//--- d.cppm67export module d;68 69export template<typename>70struct d {71	d() {}72	explicit d(int) requires(true) {}73	d(auto &&) {}74};75 76//--- e.cppm77export module e;78 79import d;80 81auto r = d<int>();82 83//--- f.cppm84export module f;85 86import a;87import b;88import c;89import d;90 91template<typename T>92struct array {93	friend void fr(array<T> const &) {94	}95};96 97array() -> array<typename a<char &>::type>;98 99struct wrap {100	d<int> m;101};102 103template<typename T>104int f1(T) {105	return 1;106}107 108void f2() {109	d<int> view;110	int x = f1(view);111	typename a<decltype([x]{}) &>::type;112	wrap w;113}114 115//--- g.cppm116// expected-no-diagnostics117export module g;118 119import e;120import f;121