[ir] Remove std::optional from remapped_entry_point_name

Use an empty string to indicate that no remapping should be performed
instead. This removes the need for additional checks around this
option.

Bug: 380043958
Change-Id: I678485d359cb6280f5cda6e85a6506752e8b0d35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219255
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/hlsl/writer/common/options.h b/src/tint/lang/hlsl/writer/common/options.h
index 7cf6e9b..d49e4dd 100644
--- a/src/tint/lang/hlsl/writer/common/options.h
+++ b/src/tint/lang/hlsl/writer/common/options.h
@@ -201,7 +201,7 @@
     Options& operator=(const Options&);
 
     /// An optional remapped name to use when emitting the entry point.
-    std::optional<std::string> remapped_entry_point_name = {};
+    std::string remapped_entry_point_name = {};
 
     /// Set to `true` to strip all user-declared identifiers from the module.
     bool strip_all_names = false;
diff --git a/src/tint/lang/hlsl/writer/printer/printer.cc b/src/tint/lang/hlsl/writer/printer/printer.cc
index 20718b8..715efdb 100644
--- a/src/tint/lang/hlsl/writer/printer/printer.cc
+++ b/src/tint/lang/hlsl/writer/printer/printer.cc
@@ -262,9 +262,9 @@
             // Remap the entry point name if requested.
             auto func_name = NameOf(func);
             if (func->IsEntryPoint()) {
-                if (options_.remapped_entry_point_name) {
-                    func_name = *options_.remapped_entry_point_name;
-                    TINT_ASSERT(!IsKeyword(func_name) && !func_name.empty());
+                if (!options_.remapped_entry_point_name.empty()) {
+                    func_name = options_.remapped_entry_point_name;
+                    TINT_ASSERT(!IsKeyword(func_name));
                 }
                 result_.entry_points.push_back({func_name, ir_to_ast_stage(func->Stage())});
             }
diff --git a/src/tint/lang/msl/writer/common/options.h b/src/tint/lang/msl/writer/common/options.h
index 18f31e8..bd13057 100644
--- a/src/tint/lang/msl/writer/common/options.h
+++ b/src/tint/lang/msl/writer/common/options.h
@@ -138,7 +138,7 @@
     Options& operator=(const Options&);
 
     /// An optional remapped name to use when emitting the entry point.
-    std::optional<std::string> remapped_entry_point_name = {};
+    std::string remapped_entry_point_name = {};
 
     /// Set to `true` to strip all user-declared identifiers from the module.
     bool strip_all_names = false;
diff --git a/src/tint/lang/msl/writer/printer/printer.cc b/src/tint/lang/msl/writer/printer/printer.cc
index f7f2053..53e2f0e 100644
--- a/src/tint/lang/msl/writer/printer/printer.cc
+++ b/src/tint/lang/msl/writer/printer/printer.cc
@@ -318,9 +318,9 @@
 
             // Remap the entry point name if requested.
             auto func_name = NameOf(func);
-            if (func->IsEntryPoint() && options_.remapped_entry_point_name) {
-                func_name = *options_.remapped_entry_point_name;
-                TINT_ASSERT(!IsKeyword(func_name) && !func_name.empty());
+            if (func->IsEntryPoint() && !options_.remapped_entry_point_name.empty()) {
+                func_name = options_.remapped_entry_point_name;
+                TINT_ASSERT(!IsKeyword(func_name));
             }
 
             switch (func->Stage()) {
diff --git a/src/tint/lang/msl/writer/writer_fuzz.cc b/src/tint/lang/msl/writer/writer_fuzz.cc
index b1b67fe..ba4dced 100644
--- a/src/tint/lang/msl/writer/writer_fuzz.cc
+++ b/src/tint/lang/msl/writer/writer_fuzz.cc
@@ -38,12 +38,7 @@
 namespace tint::msl::writer {
 namespace {
 
-bool CanRun(const core::ir::Module& module, const Options& options) {
-    // If a remapped entry point name is provided, it must not be empty.
-    if (options.remapped_entry_point_name && options.remapped_entry_point_name->empty()) {
-        return false;
-    }
-
+bool CanRun(const core::ir::Module& module, const Options&) {
     // Check for unsupported module-scope variable address spaces and types.
     for (auto* inst : *module.root_block) {
         auto* var = inst->As<core::ir::Var>();
diff --git a/src/tint/lang/spirv/writer/common/options.h b/src/tint/lang/spirv/writer/common/options.h
index c009998..1f3421b 100644
--- a/src/tint/lang/spirv/writer/common/options.h
+++ b/src/tint/lang/spirv/writer/common/options.h
@@ -132,7 +132,7 @@
 /// Configuration options used for generating SPIR-V.
 struct Options {
     /// An optional remapped name to use when emitting the entry point.
-    std::optional<std::string> remapped_entry_point_name;
+    std::string remapped_entry_point_name = {};
 
     /// The bindings
     Bindings bindings;
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index 25337e1..aa28d23 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -800,8 +800,8 @@
 
         // Use the remapped entry point name if requested, otherwise use the original name.
         std::string name;
-        if (options_.remapped_entry_point_name) {
-            name = *options_.remapped_entry_point_name;
+        if (!options_.remapped_entry_point_name.empty()) {
+            name = options_.remapped_entry_point_name;
         } else {
             name = ir_.NameOf(func).Name();
         }
diff --git a/src/tint/lang/spirv/writer/writer_fuzz.cc b/src/tint/lang/spirv/writer/writer_fuzz.cc
index f1bdf05..cd974b9 100644
--- a/src/tint/lang/spirv/writer/writer_fuzz.cc
+++ b/src/tint/lang/spirv/writer/writer_fuzz.cc
@@ -40,11 +40,8 @@
 bool CanRun(const core::ir::Module& module, const Options& options) {
     // If a remapped entry point name is provided, it must not be empty, and must not contain
     // embedded null characters.
-    if (options.remapped_entry_point_name) {
-        if (options.remapped_entry_point_name->empty()) {
-            return false;
-        }
-        if (options.remapped_entry_point_name->find('\0') != std::string::npos) {
+    if (!options.remapped_entry_point_name.empty()) {
+        if (options.remapped_entry_point_name.find('\0') != std::string::npos) {
             return false;
         }
     }
diff --git a/src/tint/lang/spirv/writer/writer_test.cc b/src/tint/lang/spirv/writer/writer_test.cc
index a466c3d..2f4d2ed 100644
--- a/src/tint/lang/spirv/writer/writer_test.cc
+++ b/src/tint/lang/spirv/writer/writer_test.cc
@@ -138,7 +138,7 @@
     });
 
     Options options;
-    options.remapped_entry_point_name = {};
+    options.remapped_entry_point_name = "";
     ASSERT_TRUE(Generate(options)) << Error() << output_;
     EXPECT_INST("OpEntryPoint GLCompute %main \"main\"");
 }