dawncpp.h: Don't expose the fluent syntax for non-builders

At this point this change is a noop, however encoders introduced in
follow-up patches aren't builders and thus won't have the fluent syntax.

BUG=dawn:5

Change-Id: Idc5f327a1a7788c3ba16a50491aefb054700f257
Reviewed-on: https://dawn-review.googlesource.com/1540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/apicpp.cpp b/generator/templates/apicpp.cpp
index c296399..4a59356 100644
--- a/generator/templates/apicpp.cpp
+++ b/generator/templates/apicpp.cpp
@@ -58,7 +58,7 @@
 
         {% macro render_cpp_method_declaration(type, method) %}
             {% set CppType = as_cppType(type.name) %}
-            {% if method.return_type.name.concatcase() == "void" -%}
+            {% if method.return_type.name.concatcase() == "void" and type.is_builder -%}
                 {{CppType}} const&
             {%- else -%}
                 {{as_cppType(method.return_type.name)}}
@@ -99,7 +99,9 @@
             {{render_cpp_method_declaration(type, method)}} {
                 {% if method.return_type.name.concatcase() == "void" %}
                     {{render_cpp_to_c_method_call(type, method)}};
-                    return *this;
+                    {% if type.is_builder %}
+                        return *this;
+                    {% endif %}
                 {% else %}
                     auto result = {{render_cpp_to_c_method_call(type, method)}};
                     {% if method.return_type.category == "native" %} 
diff --git a/generator/templates/apicpp.h b/generator/templates/apicpp.h
index f0b9aad..68873ac 100644
--- a/generator/templates/apicpp.h
+++ b/generator/templates/apicpp.h
@@ -113,7 +113,7 @@
 
     {% macro render_cpp_method_declaration(type, method) %}
         {% set CppType = as_cppType(type.name) %}
-        {% if method.return_type.name.concatcase() == "void" -%}
+        {% if method.return_type.name.concatcase() == "void" and type.is_builder -%}
             {{CppType}} const&
         {%- else -%}
             {{as_cppType(method.return_type.name)}}