Skip to content

Commit 7027f0e

Browse files
committed
Use -fmodules-reduced-bmi
1 parent b46c8fa commit 7027f0e

File tree

5 files changed

+34
-36
lines changed

5 files changed

+34
-36
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,8 +3031,8 @@ defm skip_odr_check_in_gmf : BoolOption<"f", "skip-odr-check-in-gmf",
30313031
"Perform ODR checks for decls in the global module fragment.">>,
30323032
Group<f_Group>;
30333033

3034-
def gen_reduced_bmi : Flag<["-"], "fgen-reduced-bmi">,
3035-
Group<i_Group>, Visibility<[ClangOption, CC1Option]>,
3034+
def modules_reduced_bmi : Flag<["-"], "fmodules-reduced-bmi">,
3035+
Group<f_Group>, Visibility<[ClangOption, CC1Option]>,
30363036
HelpText<"Generate the reduced BMI">,
30373037
MarshallingInfoFlag<FrontendOpts<"GenReducedBMI">>;
30383038

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4749,11 +4749,11 @@ Action *Driver::ConstructPhaseAction(
47494749
if (Args.hasArg(options::OPT_extract_api))
47504750
return C.MakeAction<ExtractAPIJobAction>(Input, types::TY_API_INFO);
47514751

4752-
// With '-fgen-reduced-bmi', we don't want to run the precompile phase
4752+
// With '-fmodules-reduced-bmi', we don't want to run the precompile phase
47534753
// unless the user specified '--precompile'. In the case the '--precompile'
47544754
// flag is enabled, we will try to emit the reduced BMI as a by product
47554755
// in GenerateModuleInterfaceAction.
4756-
if (Args.hasArg(options::OPT_gen_reduced_bmi) &&
4756+
if (Args.hasArg(options::OPT_modules_reduced_bmi) &&
47574757
!Args.getLastArg(options::OPT__precompile))
47584758
return Input;
47594759

@@ -5911,7 +5911,7 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
59115911
// `-fmodule-output`.
59125912
if (!AtTopLevel && isa<PrecompileJobAction>(JA) &&
59135913
JA.getType() == types::TY_ModuleFile && SpecifiedModuleOutput) {
5914-
assert(!C.getArgs().hasArg(options::OPT_gen_reduced_bmi));
5914+
assert(!C.getArgs().hasArg(options::OPT_modules_reduced_bmi));
59155915
return GetModuleOutputPath(C, JA, BaseInput);
59165916
}
59175917

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4045,13 +4045,13 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
40454045
// module fragment.
40464046
CmdArgs.push_back("-fskip-odr-check-in-gmf");
40474047

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

40564056
if (Args.hasArg(options::OPT_fmodule_output_EQ))
40574057
Args.AddLastArg(CmdArgs, options::OPT_fmodule_output_EQ);
@@ -4061,7 +4061,7 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
40614061
getCXX20NamedModuleOutputPath(Args, Input.getBaseInput())));
40624062
} else {
40634063
// To avoid unused warnings.
4064-
Args.ClaimAllArgs(options::OPT_gen_reduced_bmi);
4064+
Args.ClaimAllArgs(options::OPT_modules_reduced_bmi);
40654065
Args.ClaimAllArgs(options::OPT_fmodule_output);
40664066
Args.ClaimAllArgs(options::OPT_fmodule_output_EQ);
40674067
}

clang/test/Driver/module-fgen-reduced-bmi.cppm

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,48 @@
44
// REQUIRES: !system-windows
55
// On AIX, the default output for `-c` may be `.s` instead of `.o`,
66
// which makes the test fail. So disable the test on AIX.
7-
// REQUIRES: !system-aix
7+
// UNSUPPORTED: system-aix
88
//
9-
// RUN: rm -rf %t
10-
// RUN: mkdir %t
11-
// RUN: split-file %s %t
9+
// RUN: rm -rf %t && split-file %s %t && cd %t
1210
//
13-
// RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output=%t/Hello.pcm \
14-
// RUN: -fgen-reduced-bmi -c -o %t/Hello.o -### 2>&1 | FileCheck %t/Hello.cppm
11+
// RUN: %clang -std=c++20 Hello.cppm -fmodule-output=Hello.pcm \
12+
// RUN: -fmodules-reduced-bmi -c -o Hello.o -### 2>&1 | FileCheck Hello.cppm
1513
//
16-
// RUN: %clang -std=c++20 %t/Hello.cppm \
17-
// RUN: -fgen-reduced-bmi -c -o %t/Hello.o -### 2>&1 | \
18-
// RUN: FileCheck %t/Hello.cppm --check-prefix=CHECK-UNSPECIFIED
14+
// RUN: %clang -std=c++20 Hello.cppm \
15+
// RUN: -fmodules-reduced-bmi -c -o Hello.o -### 2>&1 | \
16+
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-UNSPECIFIED
1917
//
20-
// RUN: %clang -std=c++20 %t/Hello.cppm \
21-
// RUN: -fgen-reduced-bmi -c -### 2>&1 | \
22-
// RUN: FileCheck %t/Hello.cppm --check-prefix=CHECK-NO-O
18+
// RUN: %clang -std=c++20 Hello.cppm \
19+
// RUN: -fmodules-reduced-bmi -c -### 2>&1 | \
20+
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-NO-O
2321
//
24-
// RUN: %clang -std=c++20 %t/Hello.cppm \
25-
// RUN: -fgen-reduced-bmi -c -o %t/AnotherName.o -### 2>&1 | \
26-
// RUN: FileCheck %t/Hello.cppm --check-prefix=CHECK-ANOTHER-NAME
22+
// RUN: %clang -std=c++20 Hello.cppm \
23+
// RUN: -fmodules-reduced-bmi -c -o AnotherName.o -### 2>&1 | \
24+
// RUN: FileCheck Hello.cppm --check-prefix=CHECK-ANOTHER-NAME
2725
//
28-
// RUN: %clang -std=c++20 %t/Hello.cppm --precompile -fgen-reduced-bmi \
29-
// RUN: -o %t/Hello.full.pcm -### 2>&1 | FileCheck %t/Hello.cppm \
26+
// RUN: %clang -std=c++20 Hello.cppm --precompile -fmodules-reduced-bmi \
27+
// RUN: -o Hello.full.pcm -### 2>&1 | FileCheck Hello.cppm \
3028
// RUN: --check-prefix=CHECK-EMIT-MODULE-INTERFACE
3129
//
32-
// RUN: %clang -std=c++20 %t/Hello.cc -fgen-reduced-bmi -Wall -Werror \
33-
// RUN: -c -o %t/Hello.o -### 2>&1 | FileCheck %t/Hello.cc
30+
// RUN: %clang -std=c++20 Hello.cc -fmodules-reduced-bmi -Wall -Werror \
31+
// RUN: -c -o Hello.o -### 2>&1 | FileCheck Hello.cc
3432

3533
//--- Hello.cppm
3634
export module Hello;
3735

3836
// Test that we won't generate the emit-module-interface as 2 phase compilation model.
3937
// CHECK-NOT: -emit-module-interface
40-
// CHECK: "-fgen-reduced-bmi"
38+
// CHECK: "-fmodules-reduced-bmi"
4139

42-
// CHECK-UNSPECIFIED: -fmodule-output={{.*}}/Hello.pcm
40+
// CHECK-UNSPECIFIED: -fmodule-output=Hello.pcm
4341

44-
// CHECK-NO-O: -fmodule-output={{.*}}/Hello.pcm
45-
// CHECK-ANOTHER-NAME: -fmodule-output={{.*}}/AnotherName.pcm
42+
// CHECK-NO-O: -fmodule-output=Hello.pcm
43+
// CHECK-ANOTHER-NAME: -fmodule-output=AnotherName.pcm
4644

4745
// With `-emit-module-interface` specified, we should still see the `-emit-module-interface`
4846
// flag.
4947
// CHECK-EMIT-MODULE-INTERFACE: -emit-module-interface
5048

5149
//--- Hello.cc
5250

53-
// CHECK-NOT: "-fgen-reduced-bmi"
51+
// CHECK-NOT: "-fmodules-reduced-bmi"

clang/test/Modules/gen-reduced-bmi.cppm renamed to clang/test/Modules/modules-reduced-bmi.cppm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
// RUN: split-file %s %t
44
//
55
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.reduced.pcm
6-
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fgen-reduced-bmi -fmodule-output=%t/a.pcm \
6+
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fmodules-reduced-bmi -fmodule-output=%t/a.pcm \
77
// RUN: -S -emit-llvm -o %t/a.ll
88
//
9-
// Test that the generated BMI from `-fgen-reduced-bmi -fmodule-output=` is same with
9+
// Test that the generated BMI from `-fmodules-reduced-bmi -fmodule-output=` is same with
1010
// `-emit-reduced-module-interface`.
1111
// RUN: diff %t/a.reduced.pcm %t/a.pcm
1212
//
1313
// Test that we can consume the produced BMI correctly.
1414
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
1515
//
1616
// RUN: rm -f %t/a.pcm
17-
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fgen-reduced-bmi -fmodule-output=%t/a.pcm \
17+
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -fmodules-reduced-bmi -fmodule-output=%t/a.pcm \
1818
// RUN: -emit-module-interface -o %t/a.full.pcm
1919
// RUN: diff %t/a.reduced.pcm %t/a.pcm
2020
// RUN: not diff %t/a.pcm %t/a.full.pcm

0 commit comments

Comments
 (0)