diff options
| author | ruki <[email protected]> | 2021-10-12 22:51:27 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-12 22:51:27 +0800 |
| commit | 1666e13096f40ce0cd6b1563a5bac4cc1dac5ccb (patch) | |
| tree | 3e0a1ac46103ed13b8e50a4394c166a71564cade /tests/projects/c++/modules | |
| parent | 2829b6248dc66799d1f21407bbe2ac1ddfec9d5c (diff) | |
| parent | 6d94f1182d93b04f854f90599e3878fd5826939e (diff) | |
Merge pull request #1740 from xmake-io/modules
Improve C++20 modules for clang/gcc/msvc
Diffstat (limited to 'tests/projects/c++/modules')
8 files changed, 18 insertions, 34 deletions
diff --git a/tests/projects/c++/modules/class/src/hello.mpp b/tests/projects/c++/modules/class/src/hello.mpp index 9e4ecd960..268964aa3 100644 --- a/tests/projects/c++/modules/class/src/hello.mpp +++ b/tests/projects/c++/modules/class/src/hello.mpp @@ -5,8 +5,7 @@ export namespace hello { public: say(int data); void hello(); - private: int data_; }; -}
\ No newline at end of file +} diff --git a/tests/projects/c++/modules/class/src/hello_impl.cpp b/tests/projects/c++/modules/class/src/hello_impl.cpp index 6d0008fbb..5dd555a7a 100644 --- a/tests/projects/c++/modules/class/src/hello_impl.cpp +++ b/tests/projects/c++/modules/class/src/hello_impl.cpp @@ -1,14 +1,13 @@ -module hello; - +module; #include <iostream> -using namespace std; +module hello; +using namespace std; namespace hello { say::say(int data) : data_(data) { } - void say::hello() { cout << "hello, say class: " << data_ << endl; } diff --git a/tests/projects/c++/modules/dependence/src/hello.mpp b/tests/projects/c++/modules/dependence/src/hello.mpp index 3f803afaf..abac9fcb0 100644 --- a/tests/projects/c++/modules/dependence/src/hello.mpp +++ b/tests/projects/c++/modules/dependence/src/hello.mpp @@ -1,27 +1,14 @@ export module hello; export namespace hello { -#ifdef _MSC_VER - int data__; -#else extern int data__; -#endif void say_hello(); class say { public: say(int data); void hello(); - private: int data_; }; } -/* -#ifndef _MSC_VER -export namespace { - void anonymous() { - } -} -#endif -*/
\ No newline at end of file diff --git a/tests/projects/c++/modules/dependence/src/hello_impl.cpp b/tests/projects/c++/modules/dependence/src/hello_impl.cpp index 5dbc009f4..064afebad 100644 --- a/tests/projects/c++/modules/dependence/src/hello_impl.cpp +++ b/tests/projects/c++/modules/dependence/src/hello_impl.cpp @@ -1,6 +1,7 @@ -module hello; - +module; #include <iostream> + +module hello; import mod; void inner() { @@ -13,7 +14,6 @@ namespace hello { void say_hello() { ::inner(); } say::say(int data) : data_{data} { - } void say::hello() { diff --git a/tests/projects/c++/modules/hello/src/hello.mpp b/tests/projects/c++/modules/hello/src/hello.mpp index 9bbd036f0..124bd72bc 100644 --- a/tests/projects/c++/modules/hello/src/hello.mpp +++ b/tests/projects/c++/modules/hello/src/hello.mpp @@ -1,11 +1,10 @@ -export module hello; - +module; #include <cstdio> -using namespace std; +export module hello; export namespace hello { void say(const char* str) { printf("%s\n", str); } -}
\ No newline at end of file +} diff --git a/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp index 9cee17cfd..eccfed5d3 100644 --- a/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp +++ b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp @@ -1,7 +1,7 @@ -module hello; - +module; #include <iostream> +module hello; using namespace std; namespace hello { diff --git a/tests/projects/c++/modules/inline_and_template/src/hello.mpp b/tests/projects/c++/modules/inline_and_template/src/hello.mpp index c36d54783..94d40ddaa 100644 --- a/tests/projects/c++/modules/inline_and_template/src/hello.mpp +++ b/tests/projects/c++/modules/inline_and_template/src/hello.mpp @@ -1,9 +1,9 @@ -export module hello; - +module; #include <cstdio> +export module hello; export namespace hello { inline void say_hello() { std::printf("hello world!\n"); } -}
\ No newline at end of file +} diff --git a/tests/projects/c++/modules/inline_and_template/src/say.mpp b/tests/projects/c++/modules/inline_and_template/src/say.mpp index b4d05a5f4..ab3290cf9 100644 --- a/tests/projects/c++/modules/inline_and_template/src/say.mpp +++ b/tests/projects/c++/modules/inline_and_template/src/say.mpp @@ -1,11 +1,11 @@ -export module say; - +module; #include <cstdio> +export module say; export class say { public: template <int N> void hello() { std::printf("hello, say class: %d\n", N); } -};
\ No newline at end of file +}; |
