[clang] 9160494 - Properly pass modules flags to frontend when using -std=c++20 instead of -std=c++2a.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 17:50:26 PDT 2020
Author: Richard Smith
Date: 2020-08-24T17:49:58-07:00
New Revision: 91604949ef2fc8401d17a31362c46c310d5550b6
URL: https://github.com/llvm/llvm-project/commit/91604949ef2fc8401d17a31362c46c310d5550b6
DIFF: https://github.com/llvm/llvm-project/commit/91604949ef2fc8401d17a31362c46c310d5550b6.diff
LOG: Properly pass modules flags to frontend when using -std=c++20 instead of -std=c++2a.
In passing, also teach the driver to map /std:c++latest to -std=c++20
not -std=c++2a.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cl-options.c
clang/test/Driver/modules.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2054069daa5b..d8fa77b050f8 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5584,7 +5584,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
LanguageStandard = llvm::StringSwitch<StringRef>(StdArg->getValue())
.Case("c++14", "-std=c++14")
.Case("c++17", "-std=c++17")
- .Case("c++latest", "-std=c++2a")
+ .Case("c++latest", "-std=c++20")
.Default("");
if (LanguageStandard.empty())
D.Diag(clang::diag::warn_drv_unused_argument)
@@ -5647,7 +5647,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// FIXME: Find a better way to determine whether the language has modules
// support by default, or just assume that all languages do.
bool HaveModules =
- Std && (Std->containsValue("c++2a") || Std->containsValue("c++latest"));
+ Std && (Std->containsValue("c++2a") || Std->containsValue("c++20") ||
+ Std->containsValue("c++latest"));
RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveModules);
if (Args.hasFlag(options::OPT_fpch_validate_input_files_content,
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index bc4cab0f949f..608e89c35c76 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -573,7 +573,7 @@
// STDCXX17: -std=c++17
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
-// STDCXXLATEST: -std=c++2a
+// STDCXXLATEST: -std=c++20
// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
// ENV-CL: "-ffunction-sections"
diff --git a/clang/test/Driver/modules.cpp b/clang/test/Driver/modules.cpp
index 4f4e3a414002..87b6cc640cb0 100644
--- a/clang/test/Driver/modules.cpp
+++ b/clang/test/Driver/modules.cpp
@@ -22,6 +22,7 @@
// Check use of a .pcm file in another compilation.
//
// RUN: %clang -std=c++2a -fmodule-file=%t/module.pcm -Dexport= %s -S -o %t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
+// RUN: %clang -std=c++20 -fmodule-file=%t/module.pcm -Dexport= %s -S -o %t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
//
// CHECK-USE: -cc1
// CHECK-USE-SAME: {{-emit-obj|-S}}
More information about the cfe-commits
mailing list