Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -543,6 +543,8 @@ has been deprecated. The flag will be removed in Clang 18. ``-ftrivial-auto-var-init=zero`` is now available unconditionally, to be compatible with GCC. +- ``-fmodules-ts`` has been deprecated. The flag will be removed in Clang 17. + Please use ``-std=c++20`` or higher to use standard C++ modules instead. Modified Compiler Flags ----------------------- Index: clang/include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticDriverKinds.td +++ clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -630,6 +630,11 @@ "command line to use the libc++ standard library instead">, InGroup>; +def warn_deprecated_fmodules_ts_flag : Warning< + "the '-fmodules-ts' flag is deprecated and it will be removed in Clang 17; " + "use '-std=c++20' or higher to use standard C++ modules instead">, + InGroup>; + def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">; def err_drv_invalid_object_mode : Error< Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -3634,6 +3634,7 @@ HaveModules |= HaveClangModules; if (Args.hasArg(options::OPT_fmodules_ts)) { + D.Diag(diag::warn_deprecated_fmodules_ts_flag); CmdArgs.push_back("-fmodules-ts"); HaveModules = true; } Index: clang/test/Driver/modules-ts.cpp =================================================================== --- clang/test/Driver/modules-ts.cpp +++ clang/test/Driver/modules-ts.cpp @@ -2,6 +2,7 @@ // // RUN: %clang -fmodules-ts -x c++-module --precompile %s -o %t.pcm -v 2>&1 | FileCheck %s --check-prefix=CHECK-PRECOMPILE // +// CHECK-PRECOMPILE: warning: the '-fmodules-ts' flag is deprecated and it will be removed in Clang 17; use '-std=c++20' or higher to use standard C++ modules instead [-Wdeprecated-module-ts] // CHECK-PRECOMPILE: -cc1 {{.*}} -emit-module-interface // CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm // CHECK-PRECOMPILE-SAME: -x c++ @@ -9,8 +10,9 @@ // Check compiling a .pcm file to a .o file. // -// RUN: %clang -fmodules-ts -fintegrated-as %t.pcm -c -o %t.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-COMPILE +// RUN: %clang -fmodules-ts -fintegrated-as %t.pcm -c -o %t.pcm.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-COMPILE --check-prefix=CHECK-WARN // +// CHECK-WARN: warning: the '-fmodules-ts' flag is deprecated and it will be removed in Clang 17; use '-std=c++20' or higher to use standard C++ modules instead [-Wdeprecated-module-ts] // CHECK-COMPILE: -cc1 {{.*}} -emit-obj // CHECK-COMPILE-SAME: -o {{.*}}.pcm.o // CHECK-COMPILE-SAME: -x pcm @@ -20,6 +22,7 @@ // // RUN: %clang -fmodules-ts -fmodule-file=%t.pcm -fintegrated-as -Dexport= %s -c -o %t.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE // +// CHECK-USE: warning: the '-fmodules-ts' flag is deprecated and it will be removed in Clang 17; use '-std=c++20' or higher to use standard C++ modules instead [-Wdeprecated-module-ts] // CHECK-USE: -cc1 // CHECK-USE-SAME: -emit-obj // CHECK-USE-SAME: -fmodule-file={{.*}}.pcm