[C++2b] [Modules] Handle HaveModules with C++2b

Closing https://github.com/llvm/llvm-project/issues/56803. The root
cause for this bug is that we lack a good method to detect the language
mdoe when parsing the command line. There is a FIXME too. Dut to we lack
a good solution now, keep the workaround.
This commit is contained in:
Chuanqi Xu 2022-08-01 16:02:27 +08:00
parent 2bb7c54621
commit 834a878367
2 changed files with 8 additions and 1 deletions

View File

@ -6595,7 +6595,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// support by default, or just assume that all languages do.
bool HaveModules =
Std && (Std->containsValue("c++2a") || Std->containsValue("c++20") ||
Std->containsValue("c++latest"));
Std->containsValue("c++2b") || Std->containsValue("c++latest"));
RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveModules);
if (Args.hasFlag(options::OPT_fpch_validate_input_files_content,

View File

@ -0,0 +1,7 @@
// RUN: %clang -std=c++2a -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++20 -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++2b -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++latest -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
//
// CHECK-NOT: warning: argument unused during compilation
// CHECK: -fprebuilt-module-path=.