diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc
index 3d3ae6cee2..4197cb8ace 100644
--- a/src/google/protobuf/compiler/cpp/file.cc
+++ b/src/google/protobuf/compiler/cpp/file.cc
@@ -1555,8 +1555,7 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* p) {
IncludeFile("third_party/protobuf/io/coded_stream.h", p);
IncludeFile("third_party/protobuf/arena.h", p);
IncludeFile("third_party/protobuf/arenastring.h", p);
- if ((options_.force_inline_string || options_.profile_driven_inline_string) &&
- !options_.opensource_runtime) {
+ if (IsStringInliningEnabled(options_)) {
IncludeFile("third_party/protobuf/inlined_string_field.h", p);
}
if (HasSimpleBaseClasses(file_, options_)) {
diff --git a/src/google/protobuf/compiler/cpp/helpers.cc b/src/google/protobuf/compiler/cpp/helpers.cc
index eb22167cc2..59b8d39761 100644
--- a/src/google/protobuf/compiler/cpp/helpers.cc
+++ b/src/google/protobuf/compiler/cpp/helpers.cc
@@ -940,6 +940,10 @@ float GetPresenceProbability(const FieldDescriptor* field,
return 1.f;
}
+bool IsStringInliningEnabled(const Options& options) {
+ return options.force_inline_string || IsProfileDriven(options);
+}
+
bool IsStringInlined(const FieldDescriptor* field, const Options& options) {
(void)field;
(void)options;
diff --git a/src/google/protobuf/compiler/cpp/helpers.h b/src/google/protobuf/compiler/cpp/helpers.h
index 58283f6e89..c05a696e89 100644
--- a/src/google/protobuf/compiler/cpp/helpers.h
+++ b/src/google/protobuf/compiler/cpp/helpers.h
@@ -376,6 +376,8 @@ bool IsLikelyPresent(const FieldDescriptor* field, const Options& options);
float GetPresenceProbability(const FieldDescriptor* field,
const Options& options);
+bool IsStringInliningEnabled(const Options& options);
+
// Returns true if `field` should be inlined based on PDProto profile.
bool IsStringInlined(const FieldDescriptor* field, const Options& options);
diff --git a/src/google/protobuf/compiler/cpp/options.h b/src/google/protobuf/compiler/cpp/options.h
index 87060bec8c..e8d6104ef4 100644
--- a/src/google/protobuf/compiler/cpp/options.h
+++ b/src/google/protobuf/compiler/cpp/options.h
@@ -76,7 +76,6 @@ struct Options {
bool bootstrap = false;
bool opensource_runtime = false;
bool annotate_accessor = false;
- bool profile_driven_inline_string = true;
bool force_split = false;
#ifdef PROTOBUF_STABLE_EXPERIMENTS
bool force_eagerly_verified_lazy = true;
diff --git a/src/google/protobuf/editions/golden/compare_cpp_codegen_failure.xml b/src/google/protobuf/editions/golden/compare_cpp_codegen_failure.xml
index 6b49c99534..7058840a91 100644
--- a/src/google/protobuf/editions/golden/compare_cpp_codegen_failure.xml
+++ b/src/google/protobuf/editions/golden/compare_cpp_codegen_failure.xml
@@ -5,7 +5,7 @@
-
+