diff --git a/stl/modules/std.compat.ixx b/stl/modules/std.compat.ixx index a44c4149419..174004cf713 100644 --- a/stl/modules/std.compat.ixx +++ b/stl/modules/std.compat.ixx @@ -1,6 +1,14 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +module; + +#ifdef __clang__ +#pragma clang diagnostic push +// warning: 'std' is a reserved name for a module [-Wreserved-module-identifier] +#pragma clang diagnostic ignored "-Wreserved-module-identifier" +#endif // defined(__clang__) + export module std.compat; export import std; @@ -531,3 +539,7 @@ export using std::towlower; export using std::towupper; export using std::towctrans; export using std::wctrans; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // defined(__clang__) diff --git a/stl/modules/std.ixx b/stl/modules/std.ixx index d582fc80db7..b64780ad4f6 100644 --- a/stl/modules/std.ixx +++ b/stl/modules/std.ixx @@ -34,6 +34,17 @@ module; // defines some types outside of `extern "C"` or `extern "C++"`. #include +#ifdef __clang__ +#include // TRANSITION, LLVM-37969 + +#pragma clang diagnostic push +// warning: '#include ' attaches the declarations to the named module 'std', which is not usually intended; +// consider moving that directive before the module declaration [-Winclude-angled-in-module-purview] +// warning: 'std' is a reserved name for a module [-Wreserved-module-identifier] +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#pragma clang diagnostic ignored "-Wreserved-module-identifier" +#endif // defined(__clang__) + export module std; #pragma warning(push) @@ -155,3 +166,6 @@ export module std; #include #pragma warning(pop) +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // defined(__clang__) diff --git a/tests/std/include/test_header_units_and_modules.hpp b/tests/std/include/test_header_units_and_modules.hpp index df85f9439e5..79d7275b5ea 100644 --- a/tests/std/include/test_header_units_and_modules.hpp +++ b/tests/std/include/test_header_units_and_modules.hpp @@ -284,6 +284,7 @@ void test_future() { assert(f.get() == 1729); } +#if !(defined(__clang__) && defined(_M_ARM64EC)) // TRANSITION, LLVM-158341 #if TEST_STANDARD >= 23 void test_generator() { using namespace std; @@ -297,6 +298,7 @@ void test_generator() { assert(ranges::equal(some_ints(bound), views::iota(0, bound))); } #endif // TEST_STANDARD >= 23 +#endif // ^^^ no workaround ^^^ void test_initializer_list() { using namespace std; @@ -755,7 +757,9 @@ constexpr bool impl_test_source_location() { using namespace std; const auto sl = source_location::current(); assert(sl.line() == __LINE__ - 1); +#ifndef __clang__ assert(sl.column() == 38); +#endif // !defined(__clang__) #ifdef __EDG__ assert(sl.function_name() == "bool impl_test_source_location()"sv); @@ -1198,9 +1202,11 @@ void all_cpp_header_tests() { test_fstream(); test_functional(); test_future(); +#if !(defined(__clang__) && defined(_M_ARM64EC)) // TRANSITION, LLVM-158341 #if TEST_STANDARD >= 23 test_generator(); #endif // TEST_STANDARD >= 23 +#endif // ^^^ no workaround ^^^ test_initializer_list(); test_iomanip(); test_ios(); diff --git a/tests/std/tests/P2465R3_standard_library_modules/custom_format.py b/tests/std/tests/P2465R3_standard_library_modules/custom_format.py index d7d6a69fe11..f716d65e041 100644 --- a/tests/std/tests/P2465R3_standard_library_modules/custom_format.py +++ b/tests/std/tests/P2465R3_standard_library_modules/custom_format.py @@ -21,10 +21,21 @@ def getBuildSteps(self, test, litConfig, shared): test4Cpp = os.path.join(sourceDir, 'test4.cpp') classicCpp = os.path.join(sourceDir, 'classic.cpp') - # Dependency order is important here: - inputPaths = [stdIxx, stdCompatIxx, testCpp, test2Cpp, test3Cpp, test4Cpp, classicCpp] + moduleUnits = [stdIxx, stdCompatIxx] + traditionalUnits = [testCpp, test2Cpp, test3Cpp, test4Cpp, classicCpp] - cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] + if 'clang' in test.cxx: + for modulePath in moduleUnits: + cmd = [test.cxx, '-x', 'c++-module', modulePath, '--precompile', *test.flags, *test.compileFlags] + yield TestStep(cmd, shared.execDir, shared.env, False) + + inputPaths = ['-x', 'c++-module', *moduleUnits, '-x', 'none', *traditionalUnits] + cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] + else: + # Dependency order is important here: + inputPaths = [*moduleUnits, *traditionalUnits] + + cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] if TestType.COMPILE in test.testType: cmd += ['/c'] diff --git a/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl b/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl index caece9c6b68..740d61b5221 100644 --- a/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl +++ b/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl @@ -15,9 +15,20 @@ () my $stdIxx = "$stlModulesDir\\std.ixx"; my $stdCompatIxx = "$stlModulesDir\\std.compat.ixx"; - # Dependency order is important here: - my @inputPaths = ($stdIxx, $stdCompatIxx, "test.cpp", "test2.cpp", "test3.cpp", "test4.cpp", "classic.cpp"); + my @moduleUnits = ($stdIxx, $stdCompatIxx); + my @traditionalUnits = ("test.cpp", "test2.cpp", "test3.cpp", "test4.cpp", "classic.cpp"); - Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); + if ($ENV{PM_COMPILER} =~ m/clang/) { + for my $modulePath (@moduleUnits) { + Run::ExecuteCL("-x c++-module $modulePath --precompile"); + } + + Run::ExecuteCL(join(" ", "-x", "c++-module", @moduleUnits, "-x", "none", @traditionalUnits, "/Fe$cwd.exe")); + } else { + # Dependency order is important here: + my @inputPaths = ($stdIxx, $stdCompatIxx, "test.cpp", "test2.cpp", "test3.cpp", "test4.cpp", "classic.cpp"); + + Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); + } } 1 diff --git a/tests/std/tests/VSO_1775715_user_defined_modules/custom_format.py b/tests/std/tests/VSO_1775715_user_defined_modules/custom_format.py index 4432e6ba306..e4f45b0181d 100644 --- a/tests/std/tests/VSO_1775715_user_defined_modules/custom_format.py +++ b/tests/std/tests/VSO_1775715_user_defined_modules/custom_format.py @@ -15,10 +15,17 @@ def getBuildSteps(self, test, litConfig, shared): sourceDir = os.path.dirname(testCpp) userIxx = os.path.join(sourceDir, 'user.ixx') - # Dependency order is important here: - inputPaths = [userIxx, testCpp] + if 'clang' in test.cxx: + cmd = [test.cxx, '-x', 'c++-module', userIxx, '--precompile', *test.flags, *test.compileFlags] + yield TestStep(cmd, shared.execDir, shared.env, False) - cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] + inputPaths = ['-x', 'c++-module', userIxx, '-x', 'none', testCpp] + cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] + else: + # Dependency order is important here: + inputPaths = [userIxx, testCpp] + + cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] if TestType.COMPILE in test.testType: cmd += ['/c'] diff --git a/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl b/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl index cd5b08f5d5a..2461a3f7e7d 100644 --- a/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl +++ b/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl @@ -10,9 +10,14 @@ () { my $cwd = Run::GetCWDName(); - # Dependency order is important here: - my @inputPaths = ("user.ixx", "test.cpp"); + if ($ENV{PM_COMPILER} =~ m/clang/) { + Run::ExecuteCL("-x c++-module user.ixx --precompile"); + Run::ExecuteCL("-x c++-module user.ixx -x none test.cpp /Fe$cwd.exe"); + } else { + # Dependency order is important here: + my @inputPaths = ("user.ixx", "test.cpp"); - Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); + Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); + } } 1 diff --git a/tests/std/tests/modules_20_matrix.lst b/tests/std/tests/modules_20_matrix.lst index 6ccb872fd81..eb8a0f816e0 100644 --- a/tests/std/tests/modules_20_matrix.lst +++ b/tests/std/tests/modules_20_matrix.lst @@ -3,18 +3,25 @@ RUNALL_INCLUDE ..\..\universal_prefix.lst RUNALL_CROSSLIST -* PM_CL="/w14365 /D_ENFORCE_FACET_SPECIALIZATIONS=1 /Zc:preprocessor" +* PM_CL="/w14365 /D_ENFORCE_FACET_SPECIALIZATIONS=1" RUNALL_CROSSLIST * PM_CL="/w14640 /Zc:threadSafeInit- /EHsc /DTEST_STANDARD=20 /std:c++20" * PM_CL="/w14640 /Zc:threadSafeInit- /EHsc /DTEST_STANDARD=23 /std:c++latest" RUNALL_CROSSLIST -* PM_CL="/MD" -* PM_CL="/MDd" -* PM_CL="/MT" -* PM_CL="/MTd" -* PM_CL="/MDd /analyze:only /analyze:autolog-" -* PM_CL="/MDd /GR- /D_HAS_STATIC_RTTI=0" -* PM_CL="/MDd /utf-8" -RUNALL_CROSSLIST -PM_CL="" -ASAN PM_CL="-fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MD /Zc:preprocessor" +ASAN PM_CL="/MD /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MDd /Zc:preprocessor" +ASAN PM_CL="/MDd /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MT /Zc:preprocessor" +ASAN PM_CL="/MT /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MTd /Zc:preprocessor" +ASAN PM_CL="/MTd /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MDd /analyze:only /analyze:autolog- /Zc:preprocessor" +ASAN PM_CL="/MDd /analyze:only /analyze:autolog- /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MDd /GR- /D_HAS_STATIC_RTTI=0 /Zc:preprocessor" +ASAN PM_CL="/MDd /GR- /D_HAS_STATIC_RTTI=0 /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_CL="/MDd /utf-8 /Zc:preprocessor" +ASAN PM_CL="/MDd /utf-8 /Zc:preprocessor -fsanitize=address /Zi" PM_LINK="/debug" +PM_COMPILER="clang-cl" PM_CL="-fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MD" +PM_COMPILER="clang-cl" PM_CL="-fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MTd" +PM_COMPILER="clang-cl" PM_CL="-fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MT"