Skip to content

Commit 513a646

Browse files
authored
[NFC][clang] Refactor CXX/module/module.interface/p1.cpp with split-file (#148861)
Refine CXX/module/module.interface/p1.cpp with split-file. This MR is a part of #107168. Signed-off-by: yronglin <yronglin777@gmail.com>
1 parent 5ff99f2 commit 513a646

File tree

1 file changed

+24
-18
lines changed
  • clang/test/CXX/module/module.interface

1 file changed

+24
-18
lines changed
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
1-
// RUN: %clang_cc1 -std=c++2a %s -DERRORS -verify
2-
// RUN: %clang_cc1 -std=c++2a %s -emit-module-interface -o %t.pcm
3-
// RUN: %clang_cc1 -std=c++2a %s -fmodule-file=M=%t.pcm -DIMPLEMENTATION -verify -Db=b2 -Dc=c2
1+
// RUN: rm -rf %t
2+
// RUN: split-file %s %t
43

5-
module;
4+
// RUN: %clang_cc1 -std=c++2a %t/errors.cpp -verify
5+
// RUN: %clang_cc1 -std=c++2a %t/M.cppm -emit-module-interface -o %t/M.pcm
6+
// RUN: %clang_cc1 -std=c++2a %t/impl.cpp -fmodule-file=M=%t/M.pcm -verify
67

7-
#ifdef ERRORS
8+
//--- errors.cpp
9+
module;
810
export int a; // expected-error {{export declaration can only be used within a module purview}}
9-
#endif
10-
11-
#ifndef IMPLEMENTATION
12-
export
13-
#else
14-
// expected-error@#1 {{export declaration can only be used within a module purview}}
15-
// expected-error@#2 {{export declaration can only be used within a module purview}}
16-
// expected-note@+2 1+{{add 'export'}}
17-
#endif
18-
module M;
19-
11+
export module M;
2012
export int b; // #1
2113
namespace N {
2214
export int c; // #2
2315
}
2416

25-
#ifdef ERRORS
2617
namespace { // expected-note 2{{anonymous namespace begins here}}
2718
export int d1; // expected-error {{export declaration appears within anonymous namespace}}
2819
namespace X {
@@ -35,4 +26,19 @@ export { export int f; } // expected-error {{within another export declaration}}
3526

3627
module :private; // expected-note {{private module fragment begins here}}
3728
export int priv; // expected-error {{export declaration cannot be used in a private module fragment}}
38-
#endif
29+
30+
//--- M.cppm
31+
export module M;
32+
export int b;
33+
namespace N {
34+
export int c;
35+
}
36+
37+
//--- impl.cpp
38+
module M; // #M
39+
40+
export int b2; // expected-error {{export declaration can only be used within a module purview}}
41+
namespace N {
42+
export int c2; // expected-error {{export declaration can only be used within a module purview}}
43+
}
44+
// expected-note@#M 2+{{add 'export'}}

0 commit comments

Comments
 (0)