3 // RUN: split-file %s %t
6 // RUN: %clang_cc1 -std=c++20 -xc++-user-header h1.h -emit-header-unit -o h1.pcm
7 // RUN: %clang_cc1 -std=c++20 -xc++-user-header h2.h -emit-header-unit -o h2.pcm
8 // RUN: %clang_cc1 -std=c++20 -xc++-user-header h3.h -emit-header-unit -o h3.pcm
9 // RUN: %clang_cc1 -std=c++20 -xc++-user-header h4.h -emit-header-unit -o h4.pcm
11 // RUN: %clang_cc1 -std=c++20 Xlate.cpp -o Xlate.pcm \
12 // RUN: -fmodule-file=h1.pcm -fmodule-file=h2.pcm -fmodule-file=h3.pcm \
13 // RUN: -fmodule-file=h4.pcm -fsyntax-only -Rmodule-include-translation -verify
15 // Check that we do the intended translation and not more.
16 // RUN: %clang_cc1 -std=c++20 Xlate.cpp \
17 // RUN: -fmodule-file=h1.pcm -fmodule-file=h2.pcm -fmodule-file=h3.pcm \
18 // RUN: -fmodule-file=h4.pcm -E -undef | FileCheck %s
20 // We expect no diagnostics here, the used functions should all be available.
21 // RUN: %clang_cc1 -std=c++20 Xlate.cpp \
22 // RUN: -fmodule-file=h1.pcm -fmodule-file=h2.pcm -fmodule-file=h3.pcm \
23 // RUN: -fmodule-file=h4.pcm -fsyntax-only
25 // The content of the headers is not terribly important, we just want to check
26 // whether they are textually included or include-translated.
80 module
/*nothing here*/;
82 // This should be include-translated, when the header unit for h1 is available.
83 // expected-warning@+1 {{the implementation of header units is in an experimental phase}}
84 #include "h1.h" // expected-remark-re {{treating #include as an import of module '.{{/|\\\\?}}h1.h'}}
85 // Import of a header unit is allowed, named modules are not.
86 import
"h2.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
87 // A regular, untranslated, header
92 // This is OK, the import immediately follows the module decl.
93 import
"h3.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
95 // This should *not* be include-translated, even if header unit for h4 is
99 export
void charlie() {
107 // CHECK: #pragma clang module import ".{{/|\\\\?}}h1.h"
108 // CHECK: import ".{{/|\\\\?}}h2.h"
109 // CHECK: import ".{{/|\\\\?}}h3.h"
110 // CHECK-NOT: #pragma clang module import ".{{/|\\\\?}}h4.h"