Skip to content

Commit

Permalink
Rename to -fexperimental-modules-reduced-bmi
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuanqiXu9 committed Apr 3, 2024
1 parent bc638a2 commit 7f24874
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3031,7 +3031,7 @@ defm skip_odr_check_in_gmf : BoolOption<"f", "skip-odr-check-in-gmf",
"Perform ODR checks for decls in the global module fragment.">>,
Group<f_Group>;

def modules_reduced_bmi : Flag<["-"], "fmodules-reduced-bmi">,
def modules_reduced_bmi : Flag<["-"], "fexperimental-modules-reduced-bmi">,
Group<f_Group>, Visibility<[ClangOption, CC1Option]>,
HelpText<"Generate the reduced BMI">,
MarshallingInfoFlag<FrontendOpts<"GenReducedBMI">>;
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4749,10 +4749,10 @@ Action *Driver::ConstructPhaseAction(
if (Args.hasArg(options::OPT_extract_api))
return C.MakeAction<ExtractAPIJobAction>(Input, types::TY_API_INFO);

// With '-fmodules-reduced-bmi', we don't want to run the precompile phase
// unless the user specified '--precompile'. In the case the '--precompile'
// flag is enabled, we will try to emit the reduced BMI as a by product
// in GenerateModuleInterfaceAction.
// With 'fexperimental-modules-reduced-bmi', we don't want to run the
// precompile phase unless the user specified '--precompile'. In the case
// the '--precompile' flag is enabled, we will try to emit the reduced BMI
// as a by product in GenerateModuleInterfaceAction.
if (Args.hasArg(options::OPT_modules_reduced_bmi) &&
!Args.getLastArg(options::OPT__precompile))
return Input;
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4045,13 +4045,13 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
// module fragment.
CmdArgs.push_back("-fskip-odr-check-in-gmf");

// Noop if we see '-fmodules-reduced-bmi' with other translation units than module
// units. This is more user friendly to allow end uers to enable this feature
// without asking for help from build systems.
// Noop if we see '-modules-reduced-bmi' with other translation units than
// module units. This is more user friendly to allow end uers to enable this
// feature without asking for help from build systems.
if (Args.hasArg(options::OPT_modules_reduced_bmi) &&
(Input.getType() == driver::types::TY_CXXModule ||
Input.getType() == driver::types::TY_PP_CXXModule)) {
CmdArgs.push_back("-fmodules-reduced-bmi");
CmdArgs.push_back("-fexperimental-modules-reduced-bmi");

if (Args.hasArg(options::OPT_fmodule_output_EQ))
Args.AddLastArg(CmdArgs, options::OPT_fmodule_output_EQ);
Expand Down
16 changes: 8 additions & 8 deletions clang/test/Driver/module-fgen-reduced-bmi.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
// RUN: rm -rf %t && split-file %s %t && cd %t
//
// RUN: %clang -std=c++20 Hello.cppm -fmodule-output=Hello.pcm \
// RUN: -fmodules-reduced-bmi -c -o Hello.o -### 2>&1 | FileCheck Hello.cppm
// RUN: -fexperimental-modules-reduced-bmi -c -o Hello.o -### 2>&1 | FileCheck Hello.cppm
//
// RUN: %clang -std=c++20 Hello.cppm \
// RUN: -fmodules-reduced-bmi -c -o Hello.o -### 2>&1 | \
// RUN: -fexperimental-modules-reduced-bmi -c -o Hello.o -### 2>&1 | \
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-UNSPECIFIED
//
// RUN: %clang -std=c++20 Hello.cppm \
// RUN: -fmodules-reduced-bmi -c -### 2>&1 | \
// RUN: -fexperimental-modules-reduced-bmi -c -### 2>&1 | \
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-NO-O
//
// RUN: %clang -std=c++20 Hello.cppm \
// RUN: -fmodules-reduced-bmi -c -o AnotherName.o -### 2>&1 | \
// RUN: -fexperimental-modules-reduced-bmi -c -o AnotherName.o -### 2>&1 | \
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-ANOTHER-NAME
//
// RUN: %clang -std=c++20 Hello.cppm --precompile -fmodules-reduced-bmi \
// RUN: %clang -std=c++20 Hello.cppm --precompile -fexperimental-modules-reduced-bmi \
// RUN: -o Hello.full.pcm -### 2>&1 | FileCheck Hello.cppm \
// RUN: --check-prefix=CHECK-EMIT-MODULE-INTERFACE
//
// RUN: %clang -std=c++20 Hello.cc -fmodules-reduced-bmi -Wall -Werror \
// RUN: %clang -std=c++20 Hello.cc -fexperimental-modules-reduced-bmi -Wall -Werror \
// RUN: -c -o Hello.o -### 2>&1 | FileCheck Hello.cc

//--- Hello.cppm
export module Hello;

// Test that we won't generate the emit-module-interface as 2 phase compilation model.
// CHECK-NOT: -emit-module-interface
// CHECK: "-fmodules-reduced-bmi"
// CHECK: "-fexperimental-modules-reduced-bmi"

// CHECK-UNSPECIFIED: -fmodule-output=Hello.pcm

Expand All @@ -48,4 +48,4 @@ export module Hello;

//--- Hello.cc

// CHECK-NOT: "-fmodules-reduced-bmi"
// CHECK-NOT: "-fexperimental-modules-reduced-bmi"
6 changes: 3 additions & 3 deletions clang/test/Modules/modules-reduced-bmi.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.reduced.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fmodules-reduced-bmi -fmodule-output=%t/a.pcm \
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fexperimental-modules-reduced-bmi -fmodule-output=%t/a.pcm \
// RUN: -S -emit-llvm -o %t/a.ll
//
// Test that the generated BMI from `-fmodules-reduced-bmi -fmodule-output=` is same with
// Test that the generated BMI from `-fexperimental-modules-reduced-bmi -fmodule-output=` is same with
// `-emit-reduced-module-interface`.
// RUN: diff %t/a.reduced.pcm %t/a.pcm
//
// Test that we can consume the produced BMI correctly.
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
//
// RUN: rm -f %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fmodules-reduced-bmi -fmodule-output=%t/a.pcm \
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fexperimental-modules-reduced-bmi -fmodule-output=%t/a.pcm \
// RUN: -emit-module-interface -o %t/a.full.pcm
// RUN: diff %t/a.reduced.pcm %t/a.pcm
// RUN: not diff %t/a.pcm %t/a.full.pcm
Expand Down

0 comments on commit 7f24874

Please sign in to comment.