[clang] 42c3c70 - Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun May 29 19:43:54 PDT 2022


Author: Chuanqi Xu
Date: 2022-05-30T10:43:13+08:00
New Revision: 42c3c70a9e3f0a697b8794f4e8b603091ffb12a4

URL: https://github.com/llvm/llvm-project/commit/42c3c70a9e3f0a697b8794f4e8b603091ffb12a4
DIFF: https://github.com/llvm/llvm-project/commit/42c3c70a9e3f0a697b8794f4e8b603091ffb12a4.diff

LOG: Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"

This reverts commit 99eca8353808f63670c647aeae03e0ce66eb21e0.

Since it would cause clang-tools-extra fail.

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/modules.cpp

Removed: 
    clang/test/Modules/cxx-modules.cppm


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 0343e48c1a9d1..e19baac5860aa 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1410,7 +1410,7 @@ defm async_exceptions: BoolFOption<"async-exceptions",
   PosFlag<SetTrue, [CC1Option], "Enable EH Asynchronous exceptions">, NegFlag<SetFalse>>;
 defm cxx_modules : BoolFOption<"cxx-modules",
   LangOpts<"CPlusPlusModules">, Default<cpp20.KeyPath>,
-  NegFlag<SetFalse, [CC1Option], "Disable">, PosFlag<SetTrue, [CC1Option], "Enable">,
+  NegFlag<SetFalse, [CC1Option], "Disable">, PosFlag<SetTrue, [], "Enable">,
   BothFlags<[NoXarchOption], " modules for C++">>,
   ShouldParseIf<cplusplus.KeyPath>;
 def fdebug_pass_arguments : Flag<["-"], "fdebug-pass-arguments">, Group<f_Group>;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 5106c0e327b87..936682e49299e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3627,12 +3627,6 @@ static void RenderModulesOptions(Compilation &C, const Driver &D,
     HaveModules = true;
   }
 
-  if (Args.hasFlag(options::OPT_fcxx_modules, options::OPT_fno_cxx_modules,
-                   false)) {
-    CmdArgs.push_back("-fcxx-modules");
-    HaveModules = true;
-  }
-
   // -fmodule-maps enables implicit reading of module map files. By default,
   // this is enabled if we are using Clang's flavor of precompiled modules.
   if (Args.hasFlag(options::OPT_fimplicit_module_maps,

diff  --git a/clang/test/Driver/modules.cpp b/clang/test/Driver/modules.cpp
index bac9f715f13a4..87b6cc640cb0d 100644
--- a/clang/test/Driver/modules.cpp
+++ b/clang/test/Driver/modules.cpp
@@ -73,14 +73,3 @@ import "foo.h";
 // CHECK-HEADER-UNIT-USE: BAR;
 FOO;
 #endif
-
-// Check the independent use of -fcxx-modules
-//
-// RUN: %clang++ -fcxx-modules -std=c++17 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-CXX17-MODULES
-// CHECK-CXX17-MODULES: "-fcxx-modules"
-// RUN: %clang++ -fcxx-modules -std=c++14 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-CXX14-MODULES
-// CHECK-CXX14-MODULES: "-fcxx-modules"
-// RUN: %clang++ -fcxx-modules -std=c++11 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-CXX11-MODULES
-// CHECK-CXX11-MODULES: "-fcxx-modules"
-// RUN: %clang++ -fcxx-modules -std=c++03 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-CXX03-MODULES
-// CHECK-CXX03-MODULES: "-fcxx-modules"

diff  --git a/clang/test/Modules/cxx-modules.cppm b/clang/test/Modules/cxx-modules.cppm
deleted file mode 100644
index be17f85f8d17d..0000000000000
--- a/clang/test/Modules/cxx-modules.cppm
+++ /dev/null
@@ -1,7 +0,0 @@
-// This tests that we could use C++20 modules standalone.
-// RUN: %clang -std=c++03 -fcxx-modules -fsyntax-only -Xclang -verify %s
-// RUN: %clang -std=c++11 -fcxx-modules -fsyntax-only -Xclang -verify %s
-// RUN: %clang -std=c++14 -fcxx-modules -fsyntax-only -Xclang -verify %s
-// RUN: %clang -std=c++17 -fcxx-modules -fsyntax-only -Xclang -verify %s
-// expected-no-diagnostics
-export module M;


        


More information about the cfe-commits mailing list