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,