diff --git a/stl/inc/complex b/stl/inc/complex index 3a1958fdb1d..b5fb619f99e 100644 --- a/stl/inc/complex +++ b/stl/inc/complex @@ -21,7 +21,8 @@ // https://learn.microsoft.com/cpp/build/arm64-windows-abi-conventions#base-requirements // Both floating-point and NEON support are presumed to be present in hardware. #define _FMP_USING_STD_FMA -#elif defined(_M_IX86) || defined(_M_X64) +#elif (defined(_M_IX86) || defined(_M_X64)) \ + && !(defined(_BUILD_STD_MODULE) && defined(__clang__)) // TRANSITION, LLVM-195661 #define _FMP_USING_X86_X64_INTRINSICS #include <__msvc_bit_utils.hpp> #include 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 00b289b5c3c..683e0b6223d 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) @@ -157,3 +168,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 63a9a94ee18..f91f1b40112 100644 --- a/tests/std/include/test_header_units_and_modules.hpp +++ b/tests/std/include/test_header_units_and_modules.hpp @@ -805,7 +805,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); 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..1cca3ff6358 100644 --- a/tests/std/tests/P2465R3_standard_library_modules/custom_format.py +++ b/tests/std/tests/P2465R3_standard_library_modules/custom_format.py @@ -22,7 +22,12 @@ def getBuildSteps(self, test, litConfig, shared): 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] + if 'clang' in test.config.available_features: + inputPaths = ['-x', 'c++-module', *moduleUnits, '-x', 'none', *traditionalUnits] + else: + inputPaths = [*moduleUnits, *traditionalUnits] cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] diff --git a/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl b/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl index caece9c6b68..91a42c8e5cc 100644 --- a/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl +++ b/tests/std/tests/P2465R3_standard_library_modules/custombuild.pl @@ -16,7 +16,14 @@ () 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"); + my @inputPaths; + if (($ENV{PM_COMPILER} // "") eq "clang-cl") { + @inputPaths = ("-x", "c++-module", @moduleUnits, "-x", "none", @traditionalUnits); + } else { + @inputPaths = (@moduleUnits, @traditionalUnits); + } Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); } 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..45f08071785 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 @@ -16,7 +16,10 @@ def getBuildSteps(self, test, litConfig, shared): userIxx = os.path.join(sourceDir, 'user.ixx') # Dependency order is important here: - inputPaths = [userIxx, testCpp] + if 'clang' in test.config.available_features: + inputPaths = ['-x', 'c++-module', userIxx, '-x', 'none', testCpp] + else: + inputPaths = [userIxx, testCpp] cmd = [test.cxx, *inputPaths, *test.flags, *test.compileFlags] 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..95adb3ba0ac 100644 --- a/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl +++ b/tests/std/tests/VSO_1775715_user_defined_modules/custombuild.pl @@ -11,7 +11,12 @@ () my $cwd = Run::GetCWDName(); # Dependency order is important here: - my @inputPaths = ("user.ixx", "test.cpp"); + my @inputPaths; + if (($ENV{PM_COMPILER} // "") eq "clang-cl") { + @inputPaths = ("-x", "c++-module", "user.ixx", "-x", "none", "test.cpp"); + } else { + @inputPaths = ("user.ixx", "test.cpp"); + } Run::ExecuteCL(join(" ", @inputPaths, "/Fe$cwd.exe")); } diff --git a/tests/std/tests/modules_20_matrix.lst b/tests/std/tests/modules_20_matrix.lst index 6ccb872fd81..7a2d5d5316a 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="-fmodule-output -fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MD" +PM_COMPILER="clang-cl" PM_CL="-fmodule-output -fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MTd" +PM_COMPILER="clang-cl" PM_CL="-fmodule-output -fprebuilt-module-path=. -Wno-unqualified-std-cast-call /MT"