Reland "Updates return type for bitmask fields to be the Flag version."

Adds minor fixes in a couple template files that was causing
errors on Windows debug build.

This is a reland of commit 195cb637732ebe84ba08d09ba8834fa532912dc4

Original change's description:
> Updates return type for bitmask fields to be the Flag version.
>
> github.com/webgpu-native/webgpu-headers/issues/172
>
> Change-Id: Id1ec887cbd1cc3fefdce2f20bde89b3e529a96fa
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134541
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Loko Kung <lokokung@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>

Change-Id: I9522eeec8b08ca9412ffc7719723505613a4e90d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/135320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index a6fccc4..2b3bc5f 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -705,6 +705,13 @@
         return c_prefix + name.CamelCase()
 
 
+def as_cReturnType(c_prefix, typ):
+    if typ.category != 'bitmask':
+        return as_cType(c_prefix, typ.name)
+    else:
+        return as_cType(c_prefix, typ.name) + 'Flags'
+
+
 def as_cppType(name):
     if name.native:
         return name.concatcase()
@@ -876,6 +883,7 @@
             'as_MethodSuffix': as_MethodSuffix,
             'as_cProc': as_cProc,
             'as_cType': lambda name: as_cType(c_prefix, name),
+            'as_cReturnType': lambda typ: as_cReturnType(c_prefix, typ),
             'as_cppType': as_cppType,
             'as_jsEnumValue': as_jsEnumValue,
             'convert_cType_to_cppType': convert_cType_to_cppType,
diff --git a/generator/templates/api.h b/generator/templates/api.h
index baf0cc6..7502c3c 100644
--- a/generator/templates/api.h
+++ b/generator/templates/api.h
@@ -167,7 +167,7 @@
 {% for type in by_category["object"] if len(c_methods(type)) > 0 %}
     // Procs of {{type.name.CamelCase()}}
     {% for method in c_methods(type) %}
-        typedef {{as_cType(method.return_type.name)}} (*{{as_cProc(type.name, method.name)}})(
+        typedef {{as_cReturnType(method.return_type)}} (*{{as_cProc(type.name, method.name)}})(
             {{-as_cType(type.name)}} {{as_varName(type.name)}}
             {%- for arg in method.arguments -%}
                 ,{{" "}}
@@ -193,7 +193,7 @@
 {% for type in by_category["object"] if len(c_methods(type)) > 0 %}
     // Methods of {{type.name.CamelCase()}}
     {% for method in c_methods(type) %}
-        {{API}}_EXPORT {{as_cType(method.return_type.name)}} {{as_cMethod(type.name, method.name)}}(
+        {{API}}_EXPORT {{as_cReturnType(method.return_type)}} {{as_cMethod(type.name, method.name)}}(
             {{-as_cType(type.name)}} {{as_varName(type.name)}}
             {%- for arg in method.arguments -%}
                 ,{{" "}}
diff --git a/generator/templates/dawn/native/ProcTable.cpp b/generator/templates/dawn/native/ProcTable.cpp
index 7b1922b..ae4e627 100644
--- a/generator/templates/dawn/native/ProcTable.cpp
+++ b/generator/templates/dawn/native/ProcTable.cpp
@@ -36,7 +36,7 @@
         {% for method in c_methods(type) %}
             {% set suffix = as_MethodSuffix(type.name, method.name) %}
 
-            {{as_cType(method.return_type.name)}} Native{{suffix}}(
+            {{as_cReturnType(method.return_type)}} Native{{suffix}}(
                 {{-as_cType(type.name)}} cSelf
                 {%- for arg in method.arguments -%}
                     , {{as_annotated_cType(arg)}}
diff --git a/generator/templates/dawn/native/api_dawn_native_proc.cpp b/generator/templates/dawn/native/api_dawn_native_proc.cpp
index e573c11..22b132d 100644
--- a/generator/templates/dawn/native/api_dawn_native_proc.cpp
+++ b/generator/templates/dawn/native/api_dawn_native_proc.cpp
@@ -27,7 +27,7 @@
 {% endfor %}
 {% for type in by_category["object"] %}
     {% for method in c_methods(type) %}
-        extern {{as_cType(method.return_type.name)}} Native{{as_MethodSuffix(type.name, method.name)}}(
+        extern {{as_cReturnType(method.return_type)}} Native{{as_MethodSuffix(type.name, method.name)}}(
             {{-as_cType(type.name)}} cSelf
             {%- for arg in method.arguments -%}
                 , {{as_annotated_cType(arg)}}
@@ -57,7 +57,7 @@
 
     {% for type in by_category["object"] %}
         {% for method in c_methods(type) %}
-            {{as_cType(method.return_type.name)}} {{metadata.namespace}}{{as_MethodSuffix(type.name, method.name)}}(
+            {{as_cReturnType(method.return_type)}} {{metadata.namespace}}{{as_MethodSuffix(type.name, method.name)}}(
                 {{-as_cType(type.name)}} cSelf
                 {%- for arg in method.arguments -%}
                     , {{as_annotated_cType(arg)}}
diff --git a/generator/templates/dawn/wire/client/ApiProcs.cpp b/generator/templates/dawn/wire/client/ApiProcs.cpp
index 85fe15d..9c8656d 100644
--- a/generator/templates/dawn/wire/client/ApiProcs.cpp
+++ b/generator/templates/dawn/wire/client/ApiProcs.cpp
@@ -42,7 +42,7 @@
             {% if Suffix in client_handwritten_commands %}
                 static
             {% endif %}
-            {{as_cType(method.return_type.name)}} Client{{Suffix}}(
+            {{as_cReturnType(method.return_type)}} Client{{Suffix}}(
                 {{-cType}} cSelf
                 {%- for arg in method.arguments -%}
                     , {{as_annotated_cType(arg)}}
diff --git a/generator/templates/dawn_proc.c b/generator/templates/dawn_proc.c
index 68970c6..9cd960d 100644
--- a/generator/templates/dawn_proc.c
+++ b/generator/templates/dawn_proc.c
@@ -45,7 +45,7 @@
 
 {% for type in by_category["object"] %}
     {% for method in c_methods(type) %}
-        {{as_cType(method.return_type.name)}} {{as_cMethod(type.name, method.name)}}(
+        {{as_cReturnType(method.return_type)}} {{as_cMethod(type.name, method.name)}}(
             {{-as_cType(type.name)}} {{as_varName(type.name)}}
             {%- for arg in method.arguments -%}
                 , {{as_annotated_cType(arg)}}
diff --git a/generator/templates/dawn_thread_dispatch_proc.cpp b/generator/templates/dawn_thread_dispatch_proc.cpp
index fc79464..bff025d 100644
--- a/generator/templates/dawn_thread_dispatch_proc.cpp
+++ b/generator/templates/dawn_thread_dispatch_proc.cpp
@@ -32,7 +32,7 @@
 
 {% for type in by_category["object"] %}
     {% for method in c_methods(type) %}
-        static {{as_cType(method.return_type.name)}} ThreadDispatch{{as_MethodSuffix(type.name, method.name)}}(
+        static {{as_cReturnType(method.return_type)}} ThreadDispatch{{as_MethodSuffix(type.name, method.name)}}(
             {{-as_cType(type.name)}} {{as_varName(type.name)}}
             {%- for arg in method.arguments -%}
                 , {{as_annotated_cType(arg)}}