Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Aug 2019 18:49:37 +0000 (18:49 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Aug 2019 18:49:37 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200756

Reviewed by Darin Adler.

Source/WebCore:

Update call sites for rename from StringBuilder::flexibleAppend(...) to
StringBuilder::append(...).

* Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceHelperTypes):
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceSignature):
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitBuiltInsSignature):
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledInputPath):
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledOutputPath):
(WebCore::WHLSL::Metal::EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns):
(WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitHelperTypes):
(WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitSignature):
(WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitUnpack):
(WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitPack):
(WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitHelperTypes):
(WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitSignature):
(WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitUnpack):
(WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitPack):
(WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitSignature):
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::declareFunction):
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString):
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
(WebCore::WHLSL::Metal::inlineNativeFunction):
* Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
(WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
(WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Types::appendNameTo):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
* testing/Internals.cpp:
(WebCore::Internals::ongoingLoadsDescriptions const):

Source/WebKit:

Update call sites for rename from StringBuilder::flexibleAppend(...) to
StringBuilder::append(...).

* WebProcess/WebPage/WebPage.cpp:
(WebKit::dumpHistoryItem):
We have to explicitly access the underlying String of the URL rather than
relying on the implicit conversion since it is now ambiguous which append(...)
overload should be used.

Source/WTF:

Now that there are no remaining multi-parameter or behavior changing overloads
of StringBuilder::append(...), we can rename StringBuilder::flexibleAppend(...)
to StringBuilder::append(...).

This change leaves the existing single parameter overloads StringBuilder::append(...)
for now, and since they have specify specific types, they will continue to be prefered
in overload resolution. Once we have concluded the variadic StringBuilder::append(...)
can provide the same performance as the single parameter variant, we can remove the
single parameter variant.

* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::pathByAppendingComponents):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::appendFromAdapters):
(WTF::StringBuilder::append):
(WTF::StringBuilder::flexibleAppendFromAdapters): Deleted.
(WTF::StringBuilder::flexibleAppend): Deleted.
Update for rename from StringBuilder::flexibleAppend(...) to StringBuilder::append(...).

Tools:

Update call sites for rename from StringBuilder::flexibleAppend(...) to
StringBuilder::append(...).

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248822 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/posix/FileSystemPOSIX.cpp
Source/WTF/wtf/text/StringBuilder.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp
Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp

index 0ec5c5d..efb9089 100644 (file)
@@ -1,3 +1,29 @@
+2019-08-17  Sam Weinig  <weinig@apple.com>
+
+        Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
+        https://bugs.webkit.org/show_bug.cgi?id=200756
+
+        Reviewed by Darin Adler.
+
+        Now that there are no remaining multi-parameter or behavior changing overloads
+        of StringBuilder::append(...), we can rename StringBuilder::flexibleAppend(...)
+        to StringBuilder::append(...).
+        
+        This change leaves the existing single parameter overloads StringBuilder::append(...)
+        for now, and since they have specify specific types, they will continue to be prefered
+        in overload resolution. Once we have concluded the variadic StringBuilder::append(...)
+        can provide the same performance as the single parameter variant, we can remove the
+        single parameter variant.
+
+        * wtf/posix/FileSystemPOSIX.cpp:
+        (WTF::FileSystemImpl::pathByAppendingComponents):
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::appendFromAdapters):
+        (WTF::StringBuilder::append):
+        (WTF::StringBuilder::flexibleAppendFromAdapters): Deleted.
+        (WTF::StringBuilder::flexibleAppend): Deleted.
+        Update for rename from StringBuilder::flexibleAppend(...) to StringBuilder::append(...).
+
 2019-08-15  Ryosuke Niwa  <rniwa@webkit.org>
 
         Don't use union to store NodeRareData* and RenderObject*
index 1eead29..76df40a 100644 (file)
@@ -308,7 +308,7 @@ String pathByAppendingComponents(StringView path, const Vector<StringView>& comp
     StringBuilder builder;
     builder.append(path);
     for (auto& component : components)
-        builder.flexibleAppend('/', component);
+        builder.append('/', component);
     return builder.toString();
 }
 
index 64b50a1..14c9453 100644 (file)
@@ -235,8 +235,7 @@ public:
     WTF_EXPORT_PRIVATE void appendFixedWidthNumber(float, unsigned decimalPlaces);
     WTF_EXPORT_PRIVATE void appendFixedWidthNumber(double, unsigned decimalPlaces);
 
-    // FIXME: Rename to append(...) after renaming any overloads of append that take more than one argument.
-    template<typename... StringTypes> void flexibleAppend(StringTypes...);
+    template<typename... StringTypes> void append(StringTypes...);
 
     String toString()
     {
@@ -368,7 +367,7 @@ private:
     template<typename CharacterType> ALWAYS_INLINE CharacterType* getBufferCharacters();
     WTF_EXPORT_PRIVATE void reifyString() const;
 
-    template<typename... StringTypeAdapters> void flexibleAppendFromAdapters(StringTypeAdapters...);
+    template<typename... StringTypeAdapters> void appendFromAdapters(StringTypeAdapters...);
 
     mutable String m_string;
     RefPtr<StringImpl> m_buffer;
@@ -399,7 +398,7 @@ ALWAYS_INLINE UChar* StringBuilder::getBufferCharacters<UChar>()
 }
 
 template<typename... StringTypeAdapters>
-void StringBuilder::flexibleAppendFromAdapters(StringTypeAdapters... adapters)
+void StringBuilder::appendFromAdapters(StringTypeAdapters... adapters)
 {
     auto requiredLength = checkedSum<int32_t>(m_length, adapters.length()...);
     if (requiredLength.hasOverflowed()) {
@@ -425,9 +424,9 @@ void StringBuilder::flexibleAppendFromAdapters(StringTypeAdapters... adapters)
 }
 
 template<typename... StringTypes>
-void StringBuilder::flexibleAppend(StringTypes... strings)
+void StringBuilder::append(StringTypes... strings)
 {
-    flexibleAppendFromAdapters(StringTypeAdapter<StringTypes>(strings)...);
+    appendFromAdapters(StringTypeAdapter<StringTypes>(strings)...);
 }
 
 template<typename CharacterType>
index b1f91dc..6d32317 100644 (file)
@@ -1,3 +1,46 @@
+2019-08-17  Sam Weinig  <weinig@apple.com>
+
+        Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
+        https://bugs.webkit.org/show_bug.cgi?id=200756
+
+        Reviewed by Darin Adler.
+
+        Update call sites for rename from StringBuilder::flexibleAppend(...) to 
+        StringBuilder::append(...).
+
+        * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceHelperTypes):
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceSignature):
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitBuiltInsSignature):
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledInputPath):
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledOutputPath):
+        (WebCore::WHLSL::Metal::EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns):
+        (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitHelperTypes):
+        (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitSignature):
+        (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitUnpack):
+        (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitPack):
+        (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitHelperTypes):
+        (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitSignature):
+        (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitUnpack):
+        (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitPack):
+        (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitSignature):
+        * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
+        (WebCore::WHLSL::Metal::declareFunction):
+        (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
+        (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
+        (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString):
+        * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
+        (WebCore::WHLSL::Metal::inlineNativeFunction):
+        * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
+        (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
+        (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
+        * Modules/webgpu/WHLSL/WHLSLParser.cpp:
+        (WebCore::WHLSL::Types::appendNameTo):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::logLayerInfo):
+        * testing/Internals.cpp:
+        (WebCore::Internals::ongoingLoadsDescriptions const):
+
 2019-08-16  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r248772.
index b39f42b..290daa2 100644 (file)
@@ -142,7 +142,7 @@ EntryPointScaffolding::EntryPointScaffolding(AST::FunctionDefinition& functionDe
 void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder)
 {
     for (size_t i = 0; i < m_layout.size(); ++i) {
-        stringBuilder.flexibleAppend("struct ", m_namedBindGroups[i].structName, " {\n");
+        stringBuilder.append("struct ", m_namedBindGroups[i].structName, " {\n");
         Vector<std::pair<unsigned, String>> structItems;
         for (size_t j = 0; j < m_layout[i].bindings.size(); ++j) {
             auto iterator = m_resourceMap.find(&m_layout[i].bindings[j]);
@@ -170,7 +170,7 @@ void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder
             return left.first < right.first;
         });
         for (const auto& structItem : structItems)
-            stringBuilder.flexibleAppend("    ", structItem.second, '\n');
+            stringBuilder.append("    ", structItem.second, '\n');
         stringBuilder.append("};\n\n");
     }
 }
@@ -187,7 +187,7 @@ bool EntryPointScaffolding::emitResourceSignature(StringBuilder& stringBuilder,
         if (i)
             stringBuilder.append(", ");
         auto& namedBindGroup = m_namedBindGroups[i];
-        stringBuilder.flexibleAppend("device ", namedBindGroup.structName, "& ", namedBindGroup.variableName, " [[buffer(", namedBindGroup.argumentBufferIndex, ")]]");
+        stringBuilder.append("device ", namedBindGroup.structName, "& ", namedBindGroup.variableName, " [[buffer(", namedBindGroup.argumentBufferIndex, ")]]");
     }
     return true;
 }
@@ -243,10 +243,10 @@ bool EntryPointScaffolding::emitBuiltInsSignature(StringBuilder& stringBuilder,
         auto& builtInSemantic = WTF::get<AST::BuiltInSemantic>(*item.semantic);
         auto internalType = internalTypeForSemantic(builtInSemantic);
         if (!internalType.isNull())
-            stringBuilder.flexibleAppend(internalType);
+            stringBuilder.append(internalType);
         else
-            stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*item.unnamedType));
-        stringBuilder.flexibleAppend(' ', namedBuiltIn.variableName, ' ', attributeForSemantic(builtInSemantic));
+            stringBuilder.append(m_typeNamer.mangledNameForType(*item.unnamedType));
+        stringBuilder.append(' ', namedBuiltIn.variableName, ' ', attributeForSemantic(builtInSemantic));
     }
     return true;
 }
@@ -258,7 +258,7 @@ void EntryPointScaffolding::emitMangledInputPath(StringBuilder& stringBuilder, V
     AST::StructureDefinition* structureDefinition = nullptr;
     for (size_t i = 0; i < m_functionDefinition.parameters().size(); ++i) {
         if (m_functionDefinition.parameters()[i]->name() == path[0]) {
-            stringBuilder.flexibleAppend(m_parameterVariables[i]);
+            stringBuilder.append(m_parameterVariables[i]);
             auto& unifyNode = m_functionDefinition.parameters()[i]->type()->unifyNode();
             if (is<AST::NamedType>(unifyNode)) {
                 auto& namedType = downcast<AST::NamedType>(unifyNode);
@@ -274,7 +274,7 @@ void EntryPointScaffolding::emitMangledInputPath(StringBuilder& stringBuilder, V
         ASSERT(structureDefinition);
         auto* next = structureDefinition->find(path[i]);
         ASSERT(next);
-        stringBuilder.flexibleAppend('.', m_typeNamer.mangledNameForStructureElement(*next));
+        stringBuilder.append('.', m_typeNamer.mangledNameForStructureElement(*next));
         structureDefinition = nullptr;
         auto& unifyNode = next->type().unifyNode();
         if (is<AST::NamedType>(unifyNode)) {
@@ -294,7 +294,7 @@ void EntryPointScaffolding::emitMangledOutputPath(StringBuilder& stringBuilder,
         ASSERT(structureDefinition);
         auto* next = structureDefinition->find(component);
         ASSERT(next);
-        stringBuilder.flexibleAppend('.', m_typeNamer.mangledNameForStructureElement(*next));
+        stringBuilder.append('.', m_typeNamer.mangledNameForStructureElement(*next));
         structureDefinition = nullptr;
         auto& unifyNode = next->type().unifyNode();
         if (is<AST::NamedType>(unifyNode)) {
@@ -308,7 +308,7 @@ void EntryPointScaffolding::emitMangledOutputPath(StringBuilder& stringBuilder,
 void EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns(StringBuilder& stringBuilder)
 {
     for (size_t i = 0; i < m_functionDefinition.parameters().size(); ++i)
-        stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*m_functionDefinition.parameters()[i]->type()), ' ', m_parameterVariables[i], ";\n");
+        stringBuilder.append(m_typeNamer.mangledNameForType(*m_functionDefinition.parameters()[i]->type()), ' ', m_parameterVariables[i], ";\n");
 
     for (size_t i = 0; i < m_layout.size(); ++i) {
         auto variableName = m_namedBindGroups[i].variableName;
@@ -325,7 +325,7 @@ void EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns(StringBuilder& s
                 auto& unnamedType = *m_entryPointItems.inputs[iterator->value].unnamedType;
                 auto mangledTypeName = m_typeNamer.mangledNameForType(downcast<AST::ReferenceType>(unnamedType).elementType());
 
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "size_t ", lengthTemporaryName, " = ", variableName, '.', lengthElementName, ".y;\n",
                     lengthTemporaryName, " = ", lengthTemporaryName, " << 32;\n",
                     lengthTemporaryName, " = ", lengthTemporaryName, " | ", variableName, '.', lengthElementName, ".x;\n",
@@ -334,7 +334,7 @@ void EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns(StringBuilder& s
                 );
                     
                 emitMangledInputPath(stringBuilder, path);
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     " = { ", variableName, '.', elementName, ", static_cast<uint32_t>(", lengthTemporaryName, ") };\n"
                 );
             } else {
@@ -342,7 +342,7 @@ void EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns(StringBuilder& s
                 auto elementName = m_namedBindGroups[i].namedBindings[j].elementName;
                 
                 emitMangledInputPath(stringBuilder, path);
-                stringBuilder.flexibleAppend(" = ", variableName, '.', elementName, ";\n");
+                stringBuilder.append(" = ", variableName, '.', elementName, ";\n");
             }
         }
     }
@@ -354,7 +354,7 @@ void EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns(StringBuilder& s
         auto mangledTypeName = m_typeNamer.mangledNameForType(*item.unnamedType);
 
         emitMangledInputPath(stringBuilder, path);
-        stringBuilder.flexibleAppend(" = ", mangledTypeName, '(', variableName, ");\n");
+        stringBuilder.append(" = ", mangledTypeName, '(', variableName, ");\n");
     }
 }
 
@@ -392,14 +392,14 @@ VertexEntryPointScaffolding::VertexEntryPointScaffolding(AST::FunctionDefinition
 
 void VertexEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder)
 {
-    stringBuilder.flexibleAppend("struct ", m_stageInStructName, " {\n");
+    stringBuilder.append("struct ", m_stageInStructName, " {\n");
     for (auto& namedStageIn : m_namedStageIns) {
         auto mangledTypeName = m_typeNamer.mangledNameForType(*m_entryPointItems.inputs[namedStageIn.indexInEntryPointItems].unnamedType);
         auto elementName = namedStageIn.elementName;
         auto attributeIndex = namedStageIn.attributeIndex;
-        stringBuilder.flexibleAppend("    ", mangledTypeName, ' ', elementName, " [[attribute(", attributeIndex, ")]];\n");
+        stringBuilder.append("    ", mangledTypeName, ' ', elementName, " [[attribute(", attributeIndex, ")]];\n");
     }
-    stringBuilder.flexibleAppend(
+    stringBuilder.append(
         "};\n\n"
         "struct ", m_returnStructName, " {\n"
     );
@@ -408,7 +408,7 @@ void VertexEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder)
         auto& internalTypeName = m_namedOutputs[i].internalTypeName;
         auto elementName = m_namedOutputs[i].elementName;
         auto attribute = attributeForSemantic(*outputItem.semantic);
-        stringBuilder.flexibleAppend("    ", internalTypeName, ' ', elementName, ' ', attribute, ";\n");
+        stringBuilder.append("    ", internalTypeName, ' ', elementName, ' ', attribute, ";\n");
     }
     stringBuilder.append(
         "};\n\n"
@@ -419,7 +419,7 @@ void VertexEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder)
 
 void VertexEntryPointScaffolding::emitSignature(StringBuilder& stringBuilder, MangledFunctionName functionName)
 {
-    stringBuilder.flexibleAppend("vertex ", m_returnStructName, ' ', functionName, '(', m_stageInStructName, ' ', m_stageInParameterName, " [[stage_in]]");
+    stringBuilder.append("vertex ", m_returnStructName, ' ', functionName, '(', m_stageInStructName, ' ', m_stageInParameterName, " [[stage_in]]");
     emitResourceSignature(stringBuilder, IncludePrecedingComma::Yes);
     emitBuiltInsSignature(stringBuilder, IncludePrecedingComma::Yes);
     stringBuilder.append(')');
@@ -433,25 +433,25 @@ void VertexEntryPointScaffolding::emitUnpack(StringBuilder& stringBuilder)
         auto& path = m_entryPointItems.inputs[namedStageIn.indexInEntryPointItems].path;
         auto& elementName = namedStageIn.elementName;
         emitMangledInputPath(stringBuilder, path);
-        stringBuilder.flexibleAppend(" = ", m_stageInParameterName, '.', elementName, ";\n");
+        stringBuilder.append(" = ", m_stageInParameterName, '.', elementName, ";\n");
     }
 }
 
 void VertexEntryPointScaffolding::emitPack(StringBuilder& stringBuilder, MangledVariableName inputVariableName, MangledVariableName outputVariableName)
 {
-    stringBuilder.flexibleAppend(m_returnStructName, ' ', outputVariableName, ";\n");
+    stringBuilder.append(m_returnStructName, ' ', outputVariableName, ";\n");
     if (m_entryPointItems.outputs.size() == 1 && !m_entryPointItems.outputs[0].path.size()) {
         auto& elementName = m_namedOutputs[0].elementName;
-        stringBuilder.flexibleAppend(outputVariableName, '.', elementName, " = ", inputVariableName, ";\n");
+        stringBuilder.append(outputVariableName, '.', elementName, " = ", inputVariableName, ";\n");
         return;
     }
     for (size_t i = 0; i < m_entryPointItems.outputs.size(); ++i) {
         auto& elementName = m_namedOutputs[i].elementName;
         auto& internalTypeName = m_namedOutputs[i].internalTypeName;
         auto& path = m_entryPointItems.outputs[i].path;
-        stringBuilder.flexibleAppend(outputVariableName, '.', elementName, " = ", internalTypeName, '(', inputVariableName);
+        stringBuilder.append(outputVariableName, '.', elementName, " = ", internalTypeName, '(', inputVariableName);
         emitMangledOutputPath(stringBuilder, path);
-        stringBuilder.flexibleAppend(");\n");
+        stringBuilder.append(");\n");
     }
 }
 
@@ -491,14 +491,14 @@ FragmentEntryPointScaffolding::FragmentEntryPointScaffolding(AST::FunctionDefini
 
 void FragmentEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder)
 {
-    stringBuilder.flexibleAppend("struct ", m_stageInStructName, " {\n");
+    stringBuilder.append("struct ", m_stageInStructName, " {\n");
     for (auto& namedStageIn : m_namedStageIns) {
         auto mangledTypeName = m_typeNamer.mangledNameForType(*m_entryPointItems.inputs[namedStageIn.indexInEntryPointItems].unnamedType);
         auto elementName = namedStageIn.elementName;
         auto attributeIndex = namedStageIn.attributeIndex;
-        stringBuilder.flexibleAppend("    ", mangledTypeName, ' ', elementName, " [[user(user", attributeIndex, ")]];\n");
+        stringBuilder.append("    ", mangledTypeName, ' ', elementName, " [[user(user", attributeIndex, ")]];\n");
     }
-    stringBuilder.flexibleAppend(
+    stringBuilder.append(
         "};\n\n"
         "struct ", m_returnStructName, " {\n"
     );
@@ -507,7 +507,7 @@ void FragmentEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder
         auto& internalTypeName = m_namedOutputs[i].internalTypeName;
         auto elementName = m_namedOutputs[i].elementName;
         auto attribute = attributeForSemantic(*outputItem.semantic);
-        stringBuilder.flexibleAppend("    ", internalTypeName, ' ', elementName, ' ', attribute, ";\n");
+        stringBuilder.append("    ", internalTypeName, ' ', elementName, ' ', attribute, ";\n");
     }
     stringBuilder.append(
         "};\n\n"
@@ -518,7 +518,7 @@ void FragmentEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder
 
 void FragmentEntryPointScaffolding::emitSignature(StringBuilder& stringBuilder, MangledFunctionName functionName)
 {
-    stringBuilder.flexibleAppend("fragment ", m_returnStructName, ' ', functionName, '(', m_stageInStructName, ' ', m_stageInParameterName, " [[stage_in]]");
+    stringBuilder.append("fragment ", m_returnStructName, ' ', functionName, '(', m_stageInStructName, ' ', m_stageInParameterName, " [[stage_in]]");
     emitResourceSignature(stringBuilder, IncludePrecedingComma::Yes);
     emitBuiltInsSignature(stringBuilder, IncludePrecedingComma::Yes);
     stringBuilder.append(')');
@@ -532,25 +532,25 @@ void FragmentEntryPointScaffolding::emitUnpack(StringBuilder& stringBuilder)
         auto& path = m_entryPointItems.inputs[namedStageIn.indexInEntryPointItems].path;
         auto& elementName = namedStageIn.elementName;
         emitMangledInputPath(stringBuilder, path);
-        stringBuilder.flexibleAppend(" = ", m_stageInParameterName, '.', elementName, ";\n");
+        stringBuilder.append(" = ", m_stageInParameterName, '.', elementName, ";\n");
     }
 }
 
 void FragmentEntryPointScaffolding::emitPack(StringBuilder& stringBuilder, MangledVariableName inputVariableName, MangledVariableName outputVariableName)
 {
-    stringBuilder.flexibleAppend(m_returnStructName, ' ', outputVariableName, ";\n");
+    stringBuilder.append(m_returnStructName, ' ', outputVariableName, ";\n");
     if (m_entryPointItems.outputs.size() == 1 && !m_entryPointItems.outputs[0].path.size()) {
         auto& elementName = m_namedOutputs[0].elementName;
-        stringBuilder.flexibleAppend(outputVariableName, '.', elementName, " = ", inputVariableName, ";\n");
+        stringBuilder.append(outputVariableName, '.', elementName, " = ", inputVariableName, ";\n");
         return;
     }
     for (size_t i = 0; i < m_entryPointItems.outputs.size(); ++i) {
         auto& elementName = m_namedOutputs[i].elementName;
         auto& internalTypeName = m_namedOutputs[i].internalTypeName;
         auto& path = m_entryPointItems.outputs[i].path;
-        stringBuilder.flexibleAppend(outputVariableName, '.', elementName, " = ", internalTypeName, '(', inputVariableName);
+        stringBuilder.append(outputVariableName, '.', elementName, " = ", internalTypeName, '(', inputVariableName);
         emitMangledOutputPath(stringBuilder, path);
-        stringBuilder.flexibleAppend(");\n");
+        stringBuilder.append(");\n");
     }
 }
 
@@ -566,7 +566,7 @@ void ComputeEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder)
 
 void ComputeEntryPointScaffolding::emitSignature(StringBuilder& stringBuilder, MangledFunctionName functionName)
 {
-    stringBuilder.flexibleAppend("kernel void ", functionName, '(');
+    stringBuilder.append("kernel void ", functionName, '(');
     bool addedToSignature = emitResourceSignature(stringBuilder, IncludePrecedingComma::No);
     emitBuiltInsSignature(stringBuilder, addedToSignature ? IncludePrecedingComma::Yes : IncludePrecedingComma::No);
     stringBuilder.append(')');
index e500f61..dda5259 100644 (file)
@@ -54,11 +54,11 @@ static void declareFunction(StringBuilder& stringBuilder, AST::FunctionDeclarati
 
     auto iterator = functionMapping.find(&functionDeclaration);
     ASSERT(iterator != functionMapping.end());
-    stringBuilder.flexibleAppend(typeNamer.mangledNameForType(functionDeclaration.type()), ' ', iterator->value, '(');
+    stringBuilder.append(typeNamer.mangledNameForType(functionDeclaration.type()), ' ', iterator->value, '(');
     for (size_t i = 0; i < functionDeclaration.parameters().size(); ++i) {
         if (i)
             stringBuilder.append(", ");
-        stringBuilder.flexibleAppend(typeNamer.mangledNameForType(*functionDeclaration.parameters()[i]->type()));
+        stringBuilder.append(typeNamer.mangledNameForType(*functionDeclaration.parameters()[i]->type()));
     }
     stringBuilder.append(");\n");
 }
@@ -237,7 +237,7 @@ void FunctionDefinitionWriter::visit(AST::FunctionDefinition& functionDefinition
         m_entryPointScaffolding = nullptr;
     } else {
         ASSERT(m_entryPointScaffolding == nullptr);
-        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(functionDefinition.type()), ' ', iterator->value, '(');
+        m_stringBuilder.append(m_typeNamer.mangledNameForType(functionDefinition.type()), ' ', iterator->value, '(');
         for (size_t i = 0; i < functionDefinition.parameters().size(); ++i) {
             auto& parameter = functionDefinition.parameters()[i];
             if (i)
@@ -245,7 +245,7 @@ void FunctionDefinitionWriter::visit(AST::FunctionDefinition& functionDefinition
             auto parameterName = generateNextVariableName();
             auto addResult = m_variableMapping.add(&parameter, parameterName);
             ASSERT_UNUSED(addResult, addResult.isNewEntry);
-            m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*parameter->type()), ' ', parameterName);
+            m_stringBuilder.append(m_typeNamer.mangledNameForType(*parameter->type()), ' ', parameterName);
         }
         m_stringBuilder.append(")\n");
         checkErrorAndVisit(functionDefinition.block());
@@ -281,7 +281,7 @@ void FunctionDefinitionWriter::visit(AST::Break&)
         break;
     case BreakContext::Loop:
         ASSERT(m_breakOutOfCurrentLoopEarlyVariable);
-        m_stringBuilder.flexibleAppend(
+        m_stringBuilder.append(
             *m_breakOutOfCurrentLoopEarlyVariable, " = true;\n"
             "break;\n"
         );
@@ -310,20 +310,20 @@ void FunctionDefinitionWriter::emitLoop(LoopConditionLocation loopConditionLocat
 {
     SetForScope<Optional<MangledVariableName>> loopVariableScope(m_breakOutOfCurrentLoopEarlyVariable, generateNextVariableName());
 
-    m_stringBuilder.flexibleAppend(
+    m_stringBuilder.append(
         "bool ", *m_breakOutOfCurrentLoopEarlyVariable, " = false;\n",
         "while (true) {\n"
     );
 
     if (loopConditionLocation == LoopConditionLocation::BeforeBody && conditionExpression) {
         checkErrorAndVisit(*conditionExpression);
-        m_stringBuilder.flexibleAppend("if (!", takeLastValue(), ") break;\n");
+        m_stringBuilder.append("if (!", takeLastValue(), ") break;\n");
     }
 
     m_stringBuilder.append("do {\n");
     SetForScope<Optional<BreakContext>> breakContext(m_currentBreakContext, BreakContext::Loop);
     checkErrorAndVisit(body);
-    m_stringBuilder.flexibleAppend(
+    m_stringBuilder.append(
         "} while(false); \n"
         "if (", *m_breakOutOfCurrentLoopEarlyVariable, ") break;\n"
     );
@@ -337,7 +337,7 @@ void FunctionDefinitionWriter::emitLoop(LoopConditionLocation loopConditionLocat
 
     if (loopConditionLocation == LoopConditionLocation::AfterBody && conditionExpression) {
         checkErrorAndVisit(*conditionExpression);
-        m_stringBuilder.flexibleAppend("if (!", takeLastValue(), ") break;\n");
+        m_stringBuilder.append("if (!", takeLastValue(), ") break;\n");
     }
 
     m_stringBuilder.append("} \n");
@@ -364,7 +364,7 @@ void FunctionDefinitionWriter::visit(AST::ForLoop& forLoop)
 void FunctionDefinitionWriter::visit(AST::IfStatement& ifStatement)
 {
     checkErrorAndVisit(ifStatement.conditional());
-    m_stringBuilder.flexibleAppend("if (", takeLastValue(), ") {\n");
+    m_stringBuilder.append("if (", takeLastValue(), ") {\n");
     checkErrorAndVisit(ifStatement.body());
     if (ifStatement.elseBody()) {
         m_stringBuilder.append("} else {\n");
@@ -380,9 +380,9 @@ void FunctionDefinitionWriter::visit(AST::Return& returnStatement)
         if (m_entryPointScaffolding) {
             auto variableName = generateNextVariableName();
             m_entryPointScaffolding->emitPack(m_stringBuilder, takeLastValue(), variableName);
-            m_stringBuilder.flexibleAppend("return ", variableName, ";\n");
+            m_stringBuilder.append("return ", variableName, ";\n");
         } else
-            m_stringBuilder.flexibleAppend("return ", takeLastValue(), ";\n");
+            m_stringBuilder.append("return ", takeLastValue(), ";\n");
     } else
         m_stringBuilder.append("return;\n");
 }
@@ -391,7 +391,7 @@ void FunctionDefinitionWriter::visit(AST::SwitchStatement& switchStatement)
 {
     checkErrorAndVisit(switchStatement.value());
 
-    m_stringBuilder.flexibleAppend("switch (", takeLastValue(), ") {");
+    m_stringBuilder.append("switch (", takeLastValue(), ") {");
     for (auto& switchCase : switchStatement.switchCases())
         checkErrorAndVisit(switchCase);
     m_stringBuilder.append("}\n");
@@ -400,9 +400,9 @@ void FunctionDefinitionWriter::visit(AST::SwitchStatement& switchStatement)
 void FunctionDefinitionWriter::visit(AST::SwitchCase& switchCase)
 {
     if (switchCase.value()) {
-        m_stringBuilder.flexibleAppend("case ");
+        m_stringBuilder.append("case ");
         emitConstantExpressionString(*switchCase.value());
-        m_stringBuilder.flexibleAppend(":\n");
+        m_stringBuilder.append(":\n");
     } else
         m_stringBuilder.append("default:\n");
     SetForScope<Optional<BreakContext>> breakContext(m_currentBreakContext, BreakContext::Switch);
@@ -419,7 +419,7 @@ void FunctionDefinitionWriter::visit(AST::IntegerLiteral& integerLiteral)
 {
     auto variableName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(integerLiteral.resolvedType());
-    m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", integerLiteral.value(), ");\n");
+    m_stringBuilder.append(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", integerLiteral.value(), ");\n");
     appendRightValue(integerLiteral, variableName);
 }
 
@@ -427,7 +427,7 @@ void FunctionDefinitionWriter::visit(AST::UnsignedIntegerLiteral& unsignedIntege
 {
     auto variableName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(unsignedIntegerLiteral.resolvedType());
-    m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", unsignedIntegerLiteral.value(), ");\n");
+    m_stringBuilder.append(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", unsignedIntegerLiteral.value(), ");\n");
     appendRightValue(unsignedIntegerLiteral, variableName);
 }
 
@@ -435,7 +435,7 @@ void FunctionDefinitionWriter::visit(AST::FloatLiteral& floatLiteral)
 {
     auto variableName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(floatLiteral.resolvedType());
-    m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", floatLiteral.value(), ");\n");
+    m_stringBuilder.append(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", floatLiteral.value(), ");\n");
     appendRightValue(floatLiteral, variableName);
 }
 
@@ -446,7 +446,7 @@ void FunctionDefinitionWriter::visit(AST::NullLiteral& nullLiteral)
     bool isArrayReferenceType = is<AST::ArrayReferenceType>(unnamedType);
 
     auto variableName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(nullLiteral.resolvedType()), ' ', variableName, " = ");
+    m_stringBuilder.append(m_typeNamer.mangledNameForType(nullLiteral.resolvedType()), ' ', variableName, " = ");
     if (isArrayReferenceType)
         m_stringBuilder.append("{ nullptr, 0 };\n");
     else
@@ -458,7 +458,7 @@ void FunctionDefinitionWriter::visit(AST::BooleanLiteral& booleanLiteral)
 {
     auto variableName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(booleanLiteral.resolvedType());
-    m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", booleanLiteral.value() ? "true" : "false", ");\n");
+    m_stringBuilder.append(mangledTypeName, ' ', variableName, " = static_cast<", mangledTypeName, ">(", booleanLiteral.value() ? "true" : "false", ");\n");
     appendRightValue(booleanLiteral, variableName);
 }
 
@@ -468,7 +468,7 @@ void FunctionDefinitionWriter::visit(AST::EnumerationMemberLiteral& enumerationM
     ASSERT(enumerationMemberLiteral.enumerationDefinition());
     auto variableName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(enumerationMemberLiteral.resolvedType());
-    m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = ", mangledTypeName, "::", m_typeNamer.mangledNameForEnumerationMember(*enumerationMemberLiteral.enumerationMember()), ";\n");
+    m_stringBuilder.append(mangledTypeName, ' ', variableName, " = ", mangledTypeName, "::", m_typeNamer.mangledNameForEnumerationMember(*enumerationMemberLiteral.enumerationMember()), ";\n");
     appendRightValue(enumerationMemberLiteral, variableName);
 }
 
@@ -491,7 +491,7 @@ void FunctionDefinitionWriter::visit(AST::GlobalVariableReference& globalVariabl
     auto pointerName = generateNextVariableName();
     auto mangledTypeName = m_typeNamer.mangledNameForType(globalVariableReference.resolvedType());
     checkErrorAndVisit(globalVariableReference.base());
-    m_stringBuilder.flexibleAppend(
+    m_stringBuilder.append(
         "thread ", mangledTypeName, "* ", pointerName, " = &", takeLastValue(), "->", m_typeNamer.mangledNameForStructureElement(globalVariableReference.structField()), ";\n",
         mangledTypeName, ' ', valueName, " = ", "*", pointerName, ";\n"
     );
@@ -523,9 +523,9 @@ void FunctionDefinitionWriter::visit(AST::VariableDeclaration& variableDeclarati
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198160 Implement qualifiers.
     if (variableDeclaration.initializer()) {
         checkErrorAndVisit(*variableDeclaration.initializer());
-        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = ", takeLastValue(), ";\n");
+        m_stringBuilder.append(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = ", takeLastValue(), ";\n");
     } else
-        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = { };\n");
+        m_stringBuilder.append(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = { };\n");
 }
 
 void FunctionDefinitionWriter::visit(AST::AssignmentExpression& assignmentExpression)
@@ -535,9 +535,9 @@ void FunctionDefinitionWriter::visit(AST::AssignmentExpression& assignmentExpres
     checkErrorAndVisit(assignmentExpression.right());
     auto [rightName, rightNullability] = takeLastValueAndNullability();
     if (nullability == Nullability::CanBeNull)
-        m_stringBuilder.flexibleAppend("if (", pointerName, ") *", pointerName, " = ", rightName, ";\n");
+        m_stringBuilder.append("if (", pointerName, ") *", pointerName, " = ", rightName, ";\n");
     else
-        m_stringBuilder.flexibleAppend("*", pointerName, " = ", rightName, ";\n");
+        m_stringBuilder.append("*", pointerName, " = ", rightName, ";\n");
     appendRightValueWithNullability(assignmentExpression, rightName, rightNullability);
 }
 
@@ -553,7 +553,7 @@ void FunctionDefinitionWriter::visit(AST::CallExpression& callExpression)
     MangledVariableName returnName;
     if (!isVoid) {
         returnName = generateNextVariableName();
-        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(callExpression.resolvedType()), ' ', returnName, ";\n");
+        m_stringBuilder.append(m_typeNamer.mangledNameForType(callExpression.resolvedType()), ' ', returnName, ";\n");
     }
 
     if (is<AST::NativeFunctionDeclaration>(callExpression.function()))
@@ -562,12 +562,12 @@ void FunctionDefinitionWriter::visit(AST::CallExpression& callExpression)
         auto iterator = m_functionMapping.find(&callExpression.function());
         ASSERT(iterator != m_functionMapping.end());
         if (!isVoid)
-            m_stringBuilder.flexibleAppend(returnName, " = ");
-        m_stringBuilder.flexibleAppend(iterator->value, '(');
+            m_stringBuilder.append(returnName, " = ");
+        m_stringBuilder.append(iterator->value, '(');
         for (size_t i = 0; i < argumentNames.size(); ++i) {
             if (i)
                 m_stringBuilder.append(", ");
-            m_stringBuilder.flexibleAppend(argumentNames[i]);
+            m_stringBuilder.append(argumentNames[i]);
         }
         m_stringBuilder.append(");\n");
     }
@@ -592,15 +592,15 @@ void FunctionDefinitionWriter::visit(AST::DereferenceExpression& dereferenceExpr
     auto [inputPointer, nullability] = takeLastValueAndNullability();
     auto resultValue = generateNextVariableName();
     auto resultPointer = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(
+    m_stringBuilder.append(
         m_typeNamer.mangledNameForType(dereferenceExpression.pointer().resolvedType()), ' ', resultPointer, " = ", inputPointer, ";\n",
         m_typeNamer.mangledNameForType(dereferenceExpression.resolvedType()), ' ', resultValue, ";\n");
     if (nullability == Nullability::CanBeNull) {
-        m_stringBuilder.flexibleAppend(
+        m_stringBuilder.append(
             "if (", resultPointer, ") ", resultValue, " = *", inputPointer, ";\n",
             "else ", resultValue, " = { };\n");
     } else
-        m_stringBuilder.flexibleAppend(resultValue, " = *", inputPointer, ";\n");
+        m_stringBuilder.append(resultValue, " = *", inputPointer, ";\n");
     appendLeftValue(dereferenceExpression, resultValue, resultPointer, nullability);
 }
 
@@ -611,7 +611,7 @@ void FunctionDefinitionWriter::visit(AST::LogicalExpression& logicalExpression)
     checkErrorAndVisit(logicalExpression.right());
     auto right = takeLastValue();
     auto variableName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(logicalExpression.resolvedType()), ' ', variableName, " = ", left);
+    m_stringBuilder.append(m_typeNamer.mangledNameForType(logicalExpression.resolvedType()), ' ', variableName, " = ", left);
     switch (logicalExpression.type()) {
     case AST::LogicalExpression::Type::And:
         m_stringBuilder.append(" && ");
@@ -621,7 +621,7 @@ void FunctionDefinitionWriter::visit(AST::LogicalExpression& logicalExpression)
         m_stringBuilder.append(" || ");
         break;
     }
-    m_stringBuilder.flexibleAppend(right, ";\n");
+    m_stringBuilder.append(right, ";\n");
     appendRightValue(logicalExpression, variableName);
 }
 
@@ -630,7 +630,7 @@ void FunctionDefinitionWriter::visit(AST::LogicalNotExpression& logicalNotExpres
     checkErrorAndVisit(logicalNotExpression.operand());
     auto operand = takeLastValue();
     auto variableName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(logicalNotExpression.resolvedType()), ' ', variableName, " = !", operand, ";\n");
+    m_stringBuilder.append(m_typeNamer.mangledNameForType(logicalNotExpression.resolvedType()), ' ', variableName, " = !", operand, ";\n");
     appendRightValue(logicalNotExpression, variableName);
 }
 
@@ -644,7 +644,7 @@ void FunctionDefinitionWriter::visit(AST::MakeArrayReferenceExpression& makeArra
     auto mangledTypeName = m_typeNamer.mangledNameForType(makeArrayReferenceExpression.resolvedType());
     if (is<AST::PointerType>(makeArrayReferenceExpression.leftValue().resolvedType())) {
         auto ptrValue = takeLastValue();
-        m_stringBuilder.flexibleAppend(
+        m_stringBuilder.append(
             mangledTypeName, ' ', variableName, ";\n",
             "if (", ptrValue, ") ", variableName, " = { ", ptrValue, ", 1};\n",
             "else ", variableName, " = { nullptr, 0 };\n"
@@ -652,10 +652,10 @@ void FunctionDefinitionWriter::visit(AST::MakeArrayReferenceExpression& makeArra
     } else if (is<AST::ArrayType>(makeArrayReferenceExpression.leftValue().resolvedType())) {
         auto lValue = takeLastLeftValue().value;
         auto& arrayType = downcast<AST::ArrayType>(makeArrayReferenceExpression.leftValue().resolvedType());
-        m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = { ", lValue, "->data(), ", arrayType.numElements(), " };\n");
+        m_stringBuilder.append(mangledTypeName, ' ', variableName, " = { ", lValue, "->data(), ", arrayType.numElements(), " };\n");
     } else {
         auto lValue = takeLastLeftValue().value;
-        m_stringBuilder.flexibleAppend(mangledTypeName, ' ', variableName, " = { ", lValue, ", 1 };\n");
+        m_stringBuilder.append(mangledTypeName, ' ', variableName, " = { ", lValue, ", 1 };\n");
     }
     appendRightValue(makeArrayReferenceExpression, variableName);
 }
@@ -665,7 +665,7 @@ void FunctionDefinitionWriter::visit(AST::MakePointerExpression& makePointerExpr
     checkErrorAndVisit(makePointerExpression.leftValue());
     auto [pointer, nullability] = takeLastLeftValue();
     auto variableName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(makePointerExpression.resolvedType()), ' ', variableName, " = ", pointer, ";\n");
+    m_stringBuilder.append(m_typeNamer.mangledNameForType(makePointerExpression.resolvedType()), ' ', variableName, " = ", pointer, ";\n");
     appendRightValueWithNullability(makePointerExpression, variableName, nullability);
 }
 
@@ -685,7 +685,7 @@ void FunctionDefinitionWriter::visit(AST::TernaryExpression& ternaryExpression)
     auto elseBody = takeLastValue();
 
     auto variableName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(ternaryExpression.resolvedType()), ' ', variableName, " = ", check, " ? ", body, " : ", elseBody, ";\n");
+    m_stringBuilder.append(m_typeNamer.mangledNameForType(ternaryExpression.resolvedType()), ' ', variableName, " = ", check, " ? ", body, " : ", elseBody, ";\n");
     appendRightValue(ternaryExpression, variableName);
 }
 
@@ -695,7 +695,7 @@ void FunctionDefinitionWriter::visit(AST::VariableReference& variableReference)
     auto iterator = m_variableMapping.find(variableReference.variable());
     ASSERT(iterator != m_variableMapping.end());
     auto pointerName = generateNextVariableName();
-    m_stringBuilder.flexibleAppend("thread ", m_typeNamer.mangledNameForType(variableReference.resolvedType()), "* ", pointerName, " = &", iterator->value, ";\n");
+    m_stringBuilder.append("thread ", m_typeNamer.mangledNameForType(variableReference.resolvedType()), "* ", pointerName, " = &", iterator->value, ";\n");
     appendLeftValue(variableReference, iterator->value, pointerName, Nullability::NotNull);
 }
 
@@ -703,27 +703,27 @@ void FunctionDefinitionWriter::emitConstantExpressionString(AST::ConstantExpress
 {
     constantExpression.visit(WTF::makeVisitor(
         [&](AST::IntegerLiteral& integerLiteral) {
-            m_stringBuilder.flexibleAppend(integerLiteral.value());
+            m_stringBuilder.append(integerLiteral.value());
         },
         [&](AST::UnsignedIntegerLiteral& unsignedIntegerLiteral) {
-            m_stringBuilder.flexibleAppend(unsignedIntegerLiteral.value());
+            m_stringBuilder.append(unsignedIntegerLiteral.value());
         },
         [&](AST::FloatLiteral& floatLiteral) {
-            m_stringBuilder.flexibleAppend(floatLiteral.value());
+            m_stringBuilder.append(floatLiteral.value());
         },
         [&](AST::NullLiteral&) {
-            m_stringBuilder.flexibleAppend("nullptr");
+            m_stringBuilder.append("nullptr");
         },
         [&](AST::BooleanLiteral& booleanLiteral) {
             if (booleanLiteral.value())
-                m_stringBuilder.flexibleAppend("true");
+                m_stringBuilder.append("true");
             else
-                m_stringBuilder.flexibleAppend("false");
+                m_stringBuilder.append("false");
         },
         [&](AST::EnumerationMemberLiteral& enumerationMemberLiteral) {
             ASSERT(enumerationMemberLiteral.enumerationDefinition());
             ASSERT(enumerationMemberLiteral.enumerationDefinition());
-            m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*enumerationMemberLiteral.enumerationDefinition()), "::", m_typeNamer.mangledNameForEnumerationMember(*enumerationMemberLiteral.enumerationMember()));
+            m_stringBuilder.append(m_typeNamer.mangledNameForType(*enumerationMemberLiteral.enumerationDefinition()), "::", m_typeNamer.mangledNameForEnumerationMember(*enumerationMemberLiteral.enumerationMember()));
         }
     ));
 }
index 3aa64ce..0fa15c8 100644 (file)
@@ -139,7 +139,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         auto metalReturnTypeName = typeNamer.mangledNameForType(returnType);
 
         if (!nativeFunctionDeclaration.parameters().size()) {
-            stringBuilder.flexibleAppend(returnName, " = { };\n");
+            stringBuilder.append(returnName, " = { };\n");
             return;
         }
 
@@ -147,7 +147,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         if (nativeFunctionDeclaration.parameters().size() == 1) {
             auto& parameterType = *nativeFunctionDeclaration.parameters()[0]->type();
             auto metalParameterTypeName = typeNamer.mangledNameForType(parameterType);
-            stringBuilder.flexibleAppend("{\n", metalParameterTypeName, " x = ", args[0], ";\n");
+            stringBuilder.append("{\n", metalParameterTypeName, " x = ", args[0], ";\n");
 
             {
                 auto isEnumerationDefinition = [] (auto& type) {
@@ -160,14 +160,14 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
                     bool hasZeroCase = false;
                     for (auto& member : enumerationDefinition.enumerationMembers()) {
                         hasZeroCase |= !member.get().value();
-                        stringBuilder.flexibleAppend("        case ", member.get().value(), ": break;\n");
+                        stringBuilder.append("        case ", member.get().value(), ": break;\n");
                     }
                     ASSERT_UNUSED(hasZeroCase, hasZeroCase);
                     stringBuilder.append("        default: x = 0; break; }\n");
                 }
             }
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 returnName, " = static_cast<", metalReturnTypeName, ">(x);\n}\n");
 
             return;
@@ -178,14 +178,14 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             unsigned numColumns = matrixType->numberOfMatrixColumns();
             RELEASE_ASSERT(nativeFunctionDeclaration.parameters().size() == numRows || nativeFunctionDeclaration.parameters().size() == numRows * numColumns);
 
-            stringBuilder.flexibleAppend("{\n", metalReturnTypeName, " x;\n");
+            stringBuilder.append("{\n", metalReturnTypeName, " x;\n");
 
             // We need to abide by the memory layout we use for matrices here.
             if (nativeFunctionDeclaration.parameters().size() == numRows) {
                 // operator matrixMxN (vectorN, ..., vectorN)
                 for (unsigned i = 0; i < numRows; ++i) {
                     for (unsigned j = 0; j < numColumns; ++j)
-                        stringBuilder.flexibleAppend("x[", j * numRows + i, "] = ", args[i], "[", j, "];\n");
+                        stringBuilder.append("x[", j * numRows + i, "] = ", args[i], "[", j, "];\n");
                 }
 
             } else {
@@ -193,21 +193,21 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
                 unsigned index = 0;
                 for (unsigned i = 0; i < numRows; ++i) {
                     for (unsigned j = 0; j < numColumns; ++j) {
-                        stringBuilder.flexibleAppend("x[", j * numRows + i, "] = ", args[index], ";\n");
+                        stringBuilder.append("x[", j * numRows + i, "] = ", args[index], ";\n");
                         ++index;
                     }
                 }
             }
 
-            stringBuilder.flexibleAppend(returnName, " = x;\n}\n");
+            stringBuilder.append(returnName, " = x;\n}\n");
             return;
         }
 
-        stringBuilder.flexibleAppend(returnName, " = ", metalReturnTypeName, "(");
+        stringBuilder.append(returnName, " = ", metalReturnTypeName, "(");
         for (unsigned i = 0; i < nativeFunctionDeclaration.parameters().size(); ++i) {
             if (i > 0)
                 stringBuilder.append(", ");
-            stringBuilder.flexibleAppend(args[i]);
+            stringBuilder.append(args[i]);
         }
         stringBuilder.append(");\n");
         return;
@@ -221,13 +221,13 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         auto& unnamedParameterType = downcast<AST::UnnamedType>(parameterType);
         if (is<AST::ArrayType>(unnamedParameterType)) {
             auto& arrayParameterType = downcast<AST::ArrayType>(unnamedParameterType);
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 returnName, " = ", arrayParameterType.numElements(), ";\n");
             return;
         }
 
         ASSERT(is<AST::ArrayReferenceType>(unnamedParameterType));
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = ", args[0], ".length;\n");
         return;
     }
@@ -240,7 +240,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
                 auto& structureDefinition = downcast<AST::StructureDefinition>(namedType);
                 auto* structureElement = structureDefinition.find(fieldName);
                 ASSERT(structureElement);
-                stringBuilder.flexibleAppend(typeNamer.mangledNameForStructureElement(*structureElement));
+                stringBuilder.append(typeNamer.mangledNameForStructureElement(*structureElement));
                 return;
             }
             ASSERT(is<AST::NativeTypeDeclaration>(namedType));
@@ -252,18 +252,18 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             auto fieldName = nativeFunctionDeclaration.name().substring("operator."_str.length());
             fieldName = fieldName.substring(0, fieldName.length() - 1);
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 returnName, " = ", args[0], ";\n",
                 returnName, '.');
             appendMangledFieldName(fieldName);
-            stringBuilder.flexibleAppend(" = ", args[1], ";\n");
+            stringBuilder.append(" = ", args[1], ";\n");
 
             return;
         }
 
         ASSERT(nativeFunctionDeclaration.parameters().size() == 1);
         auto fieldName = nativeFunctionDeclaration.name().substring("operator."_str.length());
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = ", args[0], '.');
         appendMangledFieldName(fieldName);
         stringBuilder.append(";\n");
@@ -274,7 +274,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         ASSERT(nativeFunctionDeclaration.parameters().size() == 1);
         auto fieldName = nativeFunctionDeclaration.name().substring("operator&."_str.length());
 
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = &(", args[0], "->");
 
         auto& unnamedType = *nativeFunctionDeclaration.parameters()[0]->type();
@@ -284,9 +284,9 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             auto& structureDefinition = downcast<AST::StructureDefinition>(namedType);
             auto* structureElement = structureDefinition.find(fieldName);
             ASSERT(structureElement);
-            stringBuilder.flexibleAppend(typeNamer.mangledNameForStructureElement(*structureElement));
+            stringBuilder.append(typeNamer.mangledNameForStructureElement(*structureElement));
         } else
-            stringBuilder.flexibleAppend(fieldName);
+            stringBuilder.append(fieldName);
 
         stringBuilder.append(");\n");
 
@@ -297,7 +297,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         ASSERT(nativeFunctionDeclaration.parameters().size() == 2);
         ASSERT(is<AST::ArrayReferenceType>(*nativeFunctionDeclaration.parameters()[0]->type()));
 
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = (", args[1], " < ", args[0], ".length) ? ", " &(", args[0], ".pointer[", args[1], "]) : nullptr;\n");
             
         return;
@@ -327,19 +327,19 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
 
             unsigned numberOfRows = getMatrixType().numberOfMatrixRows();
             unsigned numberOfColumns = getMatrixType().numberOfMatrixColumns();
-            stringBuilder.flexibleAppend("do {\n", metalReturnName, " result;\n");
+            stringBuilder.append("do {\n", metalReturnName, " result;\n");
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", args[1], " >= ", numberOfRows, ") {", returnName, " = ", metalReturnName, "(0); break;}\n",
                 "    result[0] = ", args[0], '[', args[1], "];\n",
                 "    result[1] = ", args[0], '[', args[1], " + ", numberOfRows, "];\n");
 
             if (numberOfColumns >= 3)
-                stringBuilder.flexibleAppend("    result[2] = ", args[0], '[', args[1], " + ", numberOfRows * 2, "];\n");
+                stringBuilder.append("    result[2] = ", args[0], '[', args[1], " + ", numberOfRows * 2, "];\n");
             if (numberOfColumns >= 4)
-                stringBuilder.flexibleAppend("    result[3] = ", args[0], '[', args[1], " + ", numberOfRows * 3, "];\n");
+                stringBuilder.append("    result[3] = ", args[0], '[', args[1], " + ", numberOfRows * 3, "];\n");
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    ", returnName, " = result;\n",
                 "} while (0);\n");
         } else {
@@ -348,12 +348,12 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
 
             auto metalReturnName = typeNamer.mangledNameForType(nativeFunctionDeclaration.type());
 
-            stringBuilder.flexibleAppend("do {\n", metalReturnName, " result;\n");
+            stringBuilder.append("do {\n", metalReturnName, " result;\n");
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", args[1], " >= ", numElements, ") {", returnName, " = ", metalReturnName, "(0); break;}\n",
                 "    result = ", args[0], "[", args[1], "];\n");
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    ", returnName, " = result;\n",
                 "} while (0);\n");
         }
@@ -372,18 +372,18 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             unsigned numberOfRows = getMatrixType().numberOfMatrixRows();
             unsigned numberOfColumns = getMatrixType().numberOfMatrixColumns();
 
-            stringBuilder.flexibleAppend("do {\n", metalReturnName, " m = ", args[0], ";\n",
+            stringBuilder.append("do {\n", metalReturnName, " m = ", args[0], ";\n",
                 metalParameter2Name, " i = ", args[1], ";\n");
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (i >= ", numberOfRows, ") {", returnName, " = m;\nbreak;}\n",
                 "    m[i] = ", args[2], "[0];\n",
                 "    m[i + ", numberOfRows, "] = ", args[2], "[1];\n");
             if (numberOfColumns >= 3)
-                stringBuilder.flexibleAppend("    m[i + ", numberOfRows * 2, "] = ", args[2], "[2];\n");
+                stringBuilder.append("    m[i + ", numberOfRows * 2, "] = ", args[2], "[2];\n");
             if (numberOfColumns >= 4)
-                stringBuilder.flexibleAppend("    m[i + ", numberOfRows * 3, "] = ", args[2], "[3];\n");
-            stringBuilder.flexibleAppend(
+                stringBuilder.append("    m[i + ", numberOfRows * 3, "] = ", args[2], "[3];\n");
+            stringBuilder.append(
                 "    ", returnName, " = m;\n",
                 "} while(0);\n");
         } else {
@@ -395,13 +395,13 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
 
             unsigned numElements = vectorSize();
 
-            stringBuilder.flexibleAppend("do {\n", metalReturnName, " v = ", args[0], ";\n",
+            stringBuilder.append("do {\n", metalReturnName, " v = ", args[0], ";\n",
                 metalParameter2Name, " i = ", args[1], ";\n");
 
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (i >= ", numElements, ") {", returnName, " = v;\nbreak;}\n",
                 "    v[i] = ", args[2], ";\n");
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    ", returnName, " = v;\n",
                 "} while(0);\n");
         }
@@ -414,12 +414,12 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         auto metalReturnType = typeNamer.mangledNameForType(nativeFunctionDeclaration.type());
         if (nativeFunctionDeclaration.parameters().size() == 1) {
             if (auto* matrixType = asMatrixType(nativeFunctionDeclaration.type())) {
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "{\n", metalReturnType, " x = ", args[0], ";\n",
                     "for (size_t i = 0; i < x.size(); ++i) x[i] = ", operatorName, "x[i];\n",
                     returnName, " = x;\n}\n");
             } else {
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "{\n", metalReturnType, " x = ", args[0], ";\n", 
                     returnName, " = ", operatorName, "x;\n}\n");
             }
@@ -430,13 +430,13 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         if (auto* leftMatrix = asMatrixType(*nativeFunctionDeclaration.parameters()[0]->type())) {
             if (auto* rightMatrix = asMatrixType(*nativeFunctionDeclaration.parameters()[1]->type())) {
                 // matrix <op> matrix
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "{\n", metalReturnType, " x;\n",
                     "for (size_t i = 0; i < x.size(); ++i) x[i] = ", args[0], "[i] ", operatorName, ' ', args[1], "[i];\n",
                     returnName, " = x;\n}\n");
             } else {
                 // matrix <op> scalar
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "{\n", metalReturnType, " x;\n",
                     "for (size_t i = 0; i < x.size(); ++i) x[i] = ", args[0], "[i] ", operatorName, ' ', args[1], ";\n",
                     returnName, " = x;\n}\n");
@@ -444,7 +444,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         } else if (auto* rightMatrix = asMatrixType(*nativeFunctionDeclaration.parameters()[1]->type())) {
             ASSERT(!asMatrixType(*nativeFunctionDeclaration.parameters()[0]->type()));
             // scalar <op> matrix
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "{\n", metalReturnType, " x;\n",
                 "for (size_t i = 0; i < x.size(); ++i) x[i] = ", args[0], ' ', operatorName, ' ', args[1], "[i];\n",
                 returnName, " = x;\n}\n");
@@ -453,7 +453,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             // vector <op> vector
             // vector <op> scalar
             // scalar <op> vector
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 returnName, " = ", args[0], ' ', operatorName, ' ', args[1], ";\n");
         }
 
@@ -486,14 +486,14 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         || nativeFunctionDeclaration.name() == "asfloat"
         || nativeFunctionDeclaration.name() == "length") {
         ASSERT(nativeFunctionDeclaration.parameters().size() == 1);
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = ", mapFunctionName(nativeFunctionDeclaration.name()), '(', args[0], ");\n");
         return;
     }
 
     if (nativeFunctionDeclaration.name() == "pow" || nativeFunctionDeclaration.name() == "atan2") {
         ASSERT(nativeFunctionDeclaration.parameters().size() == 2);
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = ", nativeFunctionDeclaration.name(), "(", args[0], ", ", args[1], ");\n");
         return;
     }
@@ -502,12 +502,12 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         ASSERT(nativeFunctionDeclaration.parameters().size() == 3);
         if (asMatrixType(nativeFunctionDeclaration.type())) {
             auto metalReturnType = typeNamer.mangledNameForType(nativeFunctionDeclaration.type());
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "{\n", metalReturnType, " x;\n",
                 "for (size_t i = 0; i < x.size(); ++i) x[i] = clamp(", args[0], "[i], ", args[1], "[i], ", args[2], "[i]);",
                 returnName, " = x;\n}\n");
         } else {
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 returnName, " = clamp(", args[0], ", ", args[1], ", ", args[2], ");\n");
         }
         return;
@@ -539,7 +539,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
     if (nativeFunctionDeclaration.name().startsWith("Interlocked"_str)) {
         if (nativeFunctionDeclaration.name() == "InterlockedCompareExchange") {
             ASSERT(nativeFunctionDeclaration.parameters().size() == 4);
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "atomic_compare_exchange_weak_explicit(", args[0], ", &", args[1], ", ", args[2], ", memory_order_relaxed, memory_order_relaxed);\n",
                 '*', args[3], " = ", args[1], ";\n");
             return;
@@ -547,7 +547,7 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
 
         ASSERT(nativeFunctionDeclaration.parameters().size() == 3);
         auto name = atomicName(nativeFunctionDeclaration.name().substring("Interlocked"_str.length()));
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             '*', args[2], " = atomic_", name, "_explicit(", args[0], ", ", args[1], ", memory_order_relaxed);\n");
         return;
     }
@@ -561,19 +561,19 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         auto& returnType = downcast<AST::NativeTypeDeclaration>(downcast<AST::NamedType>(nativeFunctionDeclaration.type().unifyNode()));
         auto returnVectorLength = vectorLength(returnType);
 
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = ", args[0], ".sample(", args[1], ", ");
 
         if (textureType.isTextureArray()) {
             ASSERT(locationVectorLength > 1);
-            stringBuilder.flexibleAppend(args[2], '.', "xyzw"_str.substring(0, locationVectorLength - 1), ", ", args[2], '.', "xyzw"_str.substring(locationVectorLength - 1, 1));
+            stringBuilder.append(args[2], '.', "xyzw"_str.substring(0, locationVectorLength - 1), ", ", args[2], '.', "xyzw"_str.substring(locationVectorLength - 1, 1));
         } else
-            stringBuilder.flexibleAppend(args[2]);
+            stringBuilder.append(args[2]);
         if (nativeFunctionDeclaration.parameters().size() == 4)
-            stringBuilder.flexibleAppend(", ", args[3]);
+            stringBuilder.append(", ", args[3]);
         stringBuilder.append(")");
         if (!textureType.isDepthTexture())
-            stringBuilder.flexibleAppend(".", "xyzw"_str.substring(0, returnVectorLength));
+            stringBuilder.append(".", "xyzw"_str.substring(0, returnVectorLength));
         stringBuilder.append(";\n");
 
         return;
@@ -596,31 +596,31 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             String dimensions[] = { "width"_str, "height"_str, "depth"_str };
             for (int i = 0; i < locationVectorLength - 1; ++i) {
                 auto suffix = "xyzw"_str.substring(i, 1);
-                stringBuilder.flexibleAppend("    if (", args[1], '.', suffix, " < 0 || static_cast<uint32_t>(", args[1], '.', suffix, ") >= ", args[0], ".get_", dimensions[i], "()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
+                stringBuilder.append("    if (", args[1], '.', suffix, " < 0 || static_cast<uint32_t>(", args[1], '.', suffix, ") >= ", args[0], ".get_", dimensions[i], "()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
             }
             auto suffix = "xyzw"_str.substring(locationVectorLength - 1, 1);
-            stringBuilder.flexibleAppend("    if (", args[1], '.', suffix, " < 0 || static_cast<uint32_t>(", args[1], '.', suffix, ") >= ", args[0], ".get_array_size()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
+            stringBuilder.append("    if (", args[1], '.', suffix, " < 0 || static_cast<uint32_t>(", args[1], '.', suffix, ") >= ", args[0], ".get_array_size()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
         } else {
             if (locationVectorLength == 1)
-                stringBuilder.flexibleAppend("    if (", args[1], " < 0 || static_cast<uint32_t>(", args[1], ") >= ", args[0], ".get_width()) { ", returnName, " = ", metalReturnName, "(0); break;}\n");
+                stringBuilder.append("    if (", args[1], " < 0 || static_cast<uint32_t>(", args[1], ") >= ", args[0], ".get_width()) { ", returnName, " = ", metalReturnName, "(0); break;}\n");
             else {
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "    if (", args[1], ".x < 0 || static_cast<uint32_t>(", args[1], ".x) >= ", args[0], ".get_width()) {", returnName, " = ", metalReturnName, "(0); break;}\n"
                     "    if (", args[1], ".y < 0 || static_cast<uint32_t>(", args[1], ".y) >= ", args[0], ".get_height()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
 
                 if (locationVectorLength >= 3)
-                    stringBuilder.flexibleAppend("    if (", args[1], ".z < 0 || static_cast<uint32_t>(", args[1], ".z) >= ", args[0], ".get_depth()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
+                    stringBuilder.append("    if (", args[1], ".z < 0 || static_cast<uint32_t>(", args[1], ".z) >= ", args[0], ".get_depth()) {", returnName, " = ", metalReturnName, "(0); break;}\n");
             }
         }
-        stringBuilder.flexibleAppend("    ", returnName, " = ", args[0], ".read(");
+        stringBuilder.append("    ", returnName, " = ", args[0], ".read(");
         if (textureType.isTextureArray()) {
             ASSERT(locationVectorLength > 1);
-            stringBuilder.flexibleAppend("uint", vectorSuffix(locationVectorLength - 1), '(', args[1], '.', "xyzw"_str.substring(0, locationVectorLength - 1), "), uint(", args[1], '.', "xyzw"_str.substring(locationVectorLength - 1, 1), ')');
+            stringBuilder.append("uint", vectorSuffix(locationVectorLength - 1), '(', args[1], '.', "xyzw"_str.substring(0, locationVectorLength - 1), "), uint(", args[1], '.', "xyzw"_str.substring(locationVectorLength - 1, 1), ')');
         } else
-            stringBuilder.flexibleAppend("uint", vectorSuffix(locationVectorLength), '(', args[1], ')');
+            stringBuilder.append("uint", vectorSuffix(locationVectorLength), '(', args[1], ')');
         stringBuilder.append(')');
         if (!textureType.isDepthTexture())
-            stringBuilder.flexibleAppend('.', "xyzw"_str.substring(0, returnVectorLength));
+            stringBuilder.append('.', "xyzw"_str.substring(0, returnVectorLength));
         stringBuilder.append(
             ";\n"
             "} while(0);\n");
@@ -630,14 +630,14 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
 
     if (nativeFunctionDeclaration.name() == "load") {
         ASSERT(nativeFunctionDeclaration.parameters().size() == 1);
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             returnName, " = atomic_load_explicit(", args[0], ", memory_order_relaxed);\n");
         return;
     }
 
     if (nativeFunctionDeclaration.name() == "store") {
         ASSERT(nativeFunctionDeclaration.parameters().size() == 2);
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             "atomic_store_explicit(", args[0], ", ", args[1], ", memory_order_relaxed);\n");
         return;
     }
@@ -673,36 +673,36 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
         }
         ASSERT(index == nativeFunctionDeclaration.parameters().size());
 
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             "if (", widthName, ")\n"
             "    *", widthName, " = ", args[0], ".get_width(");
 
         if (hasMipLevel)
-            stringBuilder.flexibleAppend(args[1]);
+            stringBuilder.append(args[1]);
         stringBuilder.append(");\n");
         if (heightName) {
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", *heightName, ")\n"
                 "        *", *heightName, " = ", args[0], ".get_height(");
             if (hasMipLevel)
-                stringBuilder.flexibleAppend(args[1]);
+                stringBuilder.append(args[1]);
             stringBuilder.append(");\n");
         }
         if (depthName) {
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", *depthName, ")\n"
                 "        *", *depthName, " = ", args[0], ".get_depth(");
             if (hasMipLevel)
-                stringBuilder.flexibleAppend(args[1]);
+                stringBuilder.append(args[1]);
             stringBuilder.append(");\n");
         }
         if (elementsName) {
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", *elementsName, ")\n"
                 "        *", *elementsName, " = ", args[0], ".get_array_size();\n");
         }
         if (numberOfLevelsName) {
-            stringBuilder.flexibleAppend(
+            stringBuilder.append(
                 "    if (", *numberOfLevelsName, ")\n"
                 "        *", *numberOfLevelsName, " = ", args[0], ".get_num_mip_levels();\n");
         }
@@ -762,30 +762,30 @@ void inlineNativeFunction(StringBuilder& stringBuilder, AST::NativeFunctionDecla
             String dimensions[] = { "width"_str, "height"_str, "depth"_str };
             for (int i = 0; i < locationVectorLength - 1; ++i) {
                 auto suffix = "xyzw"_str.substring(i, 1);
-                stringBuilder.flexibleAppend("    if (", args[2], ".", suffix, " >= ", args[0], ".get_", dimensions[i], "()) break;\n");
+                stringBuilder.append("    if (", args[2], ".", suffix, " >= ", args[0], ".get_", dimensions[i], "()) break;\n");
             }
             auto suffix = "xyzw"_str.substring(locationVectorLength - 1, 1);
-            stringBuilder.flexibleAppend("    if (", args[2], '.', suffix, " >= ", args[0], ".get_array_size()) break;\n");
+            stringBuilder.append("    if (", args[2], '.', suffix, " >= ", args[0], ".get_array_size()) break;\n");
         } else {
             if (locationVectorLength == 1)
-                stringBuilder.flexibleAppend("    if (", args[2], " >= ", args[0], ".get_width()) break;\n");
+                stringBuilder.append("    if (", args[2], " >= ", args[0], ".get_width()) break;\n");
             else {
-                stringBuilder.flexibleAppend(
+                stringBuilder.append(
                     "    if (", args[2], ".x >= ", args[0], ".get_width()) break;\n"
                     "    if (", args[2], ".y >= ", args[0], ".get_height()) break;\n");
                 if (locationVectorLength >= 3)
-                    stringBuilder.flexibleAppend("    if (", args[2], ".z >= ", args[0], ".get_depth()) break;\n");
+                    stringBuilder.append("    if (", args[2], ".z >= ", args[0], ".get_depth()) break;\n");
             }
         }
-        stringBuilder.flexibleAppend("    ", args[0], ".write(vec<", metalInnerTypeName, ", 4>(", args[1]);
+        stringBuilder.append("    ", args[0], ".write(vec<", metalInnerTypeName, ", 4>(", args[1]);
         for (int i = 0; i < 4 - itemVectorLength; ++i)
             stringBuilder.append(", 0");
         stringBuilder.append("), ");
         if (textureType.isTextureArray()) {
             ASSERT(locationVectorLength > 1);
-            stringBuilder.flexibleAppend("uint", vectorSuffix(locationVectorLength - 1), '(', args[2], '.', "xyzw"_str.substring(0, locationVectorLength - 1), "), uint(", args[2], ".", "xyzw"_str.substring(locationVectorLength - 1, 1), ')');
+            stringBuilder.append("uint", vectorSuffix(locationVectorLength - 1), '(', args[2], '.', "xyzw"_str.substring(0, locationVectorLength - 1), "), uint(", args[2], ".", "xyzw"_str.substring(locationVectorLength - 1, 1), ')');
         } else
-            stringBuilder.flexibleAppend("uint", vectorSuffix(locationVectorLength), '(', args[2], ')');
+            stringBuilder.append("uint", vectorSuffix(locationVectorLength), '(', args[2], ')');
         stringBuilder.append(
             ");\n"
             "} while(0);\n");
index 185ba0b..25fee22 100644 (file)
@@ -335,7 +335,7 @@ public:
 private:
     void visit(AST::StructureDefinition& structureDefinition) override
     {
-        m_stringBuilder.flexibleAppend("struct ", m_mangledNameForNamedType(structureDefinition), ";\n");
+        m_stringBuilder.append("struct ", m_mangledNameForNamedType(structureDefinition), ";\n");
     }
 
     std::function<MangledOrNativeTypeName(AST::NamedType&)> m_mangledNameForNamedType;
@@ -362,19 +362,19 @@ void TypeNamer::emitUnnamedTypeDefinition(StringBuilder& stringBuilder, BaseType
     case AST::UnnamedType::Kind::TypeReference: {
         auto& namedType = downcast<ReferenceTypeNameNode>(baseTypeNameNode).namedType();
         emitNamedTypeDefinition(stringBuilder, namedType, emittedNamedTypes, emittedUnnamedTypes);
-        stringBuilder.flexibleAppend("typedef ", mangledNameForType(namedType), ' ', baseTypeNameNode.mangledName(), ";\n");
+        stringBuilder.append("typedef ", mangledNameForType(namedType), ' ', baseTypeNameNode.mangledName(), ";\n");
         break;
     }
     case AST::UnnamedType::Kind::Pointer: {
         auto& pointerType = downcast<PointerTypeNameNode>(baseTypeNameNode);
         ASSERT(baseTypeNameNode.parent());
-        stringBuilder.flexibleAppend("typedef ", toString(pointerType.addressSpace()), ' ', pointerType.parent()->mangledName(), "* ", pointerType.mangledName(), ";\n");
+        stringBuilder.append("typedef ", toString(pointerType.addressSpace()), ' ', pointerType.parent()->mangledName(), "* ", pointerType.mangledName(), ";\n");
         break;
     }
     case AST::UnnamedType::Kind::ArrayReference: {
         auto& arrayReferenceType = downcast<ArrayReferenceTypeNameNode>(baseTypeNameNode);
         ASSERT(baseTypeNameNode.parent());
-        stringBuilder.flexibleAppend(
+        stringBuilder.append(
             "struct ", arrayReferenceType.mangledName(), "{ \n"
             "    ", toString(arrayReferenceType.addressSpace()), ' ', arrayReferenceType.parent()->mangledName(), "* pointer;\n"
             "    uint32_t length;\n"
@@ -385,7 +385,7 @@ void TypeNamer::emitUnnamedTypeDefinition(StringBuilder& stringBuilder, BaseType
     case AST::UnnamedType::Kind::Array: {
         auto& arrayType = downcast<ArrayTypeNameNode>(baseTypeNameNode);
         ASSERT(baseTypeNameNode.parent());
-        stringBuilder.flexibleAppend("typedef array<", arrayType.parent()->mangledName(), ", ", arrayType.numElements(), "> ", arrayType.mangledName(), ";\n");
+        stringBuilder.append("typedef array<", arrayType.parent()->mangledName(), ", ", arrayType.numElements(), "> ", arrayType.mangledName(), ";\n");
         break;
     }
     default:
@@ -406,21 +406,21 @@ void TypeNamer::emitNamedTypeDefinition(StringBuilder& stringBuilder, AST::Named
     if (is<AST::EnumerationDefinition>(namedType)) {
         auto& enumerationDefinition = downcast<AST::EnumerationDefinition>(namedType);
         auto& baseType = enumerationDefinition.type().unifyNode();
-        stringBuilder.flexibleAppend("enum class ", mangledNameForType(enumerationDefinition), " : ", mangledNameForType(downcast<AST::NamedType>(baseType)), " {\n");
+        stringBuilder.append("enum class ", mangledNameForType(enumerationDefinition), " : ", mangledNameForType(downcast<AST::NamedType>(baseType)), " {\n");
         for (auto& enumerationMember : enumerationDefinition.enumerationMembers())
-            stringBuilder.flexibleAppend("    ", mangledNameForEnumerationMember(enumerationMember), " = ", enumerationMember.get().value(), ",\n");
+            stringBuilder.append("    ", mangledNameForEnumerationMember(enumerationMember), " = ", enumerationMember.get().value(), ",\n");
         stringBuilder.append("};\n");
     } else if (is<AST::NativeTypeDeclaration>(namedType)) {
         // Native types already have definitions. There's nothing to do.
     } else if (is<AST::StructureDefinition>(namedType)) {
         auto& structureDefinition = downcast<AST::StructureDefinition>(namedType);
-        stringBuilder.flexibleAppend("struct ", mangledNameForType(structureDefinition), " {\n");
+        stringBuilder.append("struct ", mangledNameForType(structureDefinition), " {\n");
         for (auto& structureElement : structureDefinition.structureElements())
-            stringBuilder.flexibleAppend("    ", mangledNameForType(structureElement.type()), ' ', mangledNameForStructureElement(structureElement), ";\n");
+            stringBuilder.append("    ", mangledNameForType(structureElement.type()), ' ', mangledNameForStructureElement(structureElement), ";\n");
         stringBuilder.append("};\n");
     } else {
         auto& typeDefinition = downcast<AST::TypeDefinition>(namedType);
-        stringBuilder.flexibleAppend("typedef ", mangledNameForType(typeDefinition.type()), ' ', mangledNameForType(typeDefinition), ";\n");
+        stringBuilder.append("typedef ", mangledNameForType(typeDefinition.type()), ' ', mangledNameForType(typeDefinition), ";\n");
     }
     emittedNamedTypes.add(&namedType);
 }
index 016114a..79708a1 100644 (file)
@@ -158,7 +158,7 @@ struct Types {
 
     static void appendNameTo(StringBuilder& builder)
     {
-        builder.flexibleAppend(Token::typeName(t), ", ");
+        builder.append(Token::typeName(t), ", ");
         Types<ts...>::appendNameTo(builder);
     }
 };
index 705c6dc..0a1e00e 100644 (file)
@@ -180,7 +180,7 @@ Ref<SharedBuffer> MHTMLArchive::generateMHTMLData(Page* page)
         stringBuilder.append("\r\nContent-Transfer-Encoding: ");
         stringBuilder.append(contentEncoding);
         stringBuilder.append("\r\nContent-Location: ");
-        stringBuilder.append(resource.url);
+        stringBuilder.append(resource.url.string());
         stringBuilder.append("\r\n\r\n");
 
         asciiString = stringBuilder.toString().utf8();
index abe4d4d..412c2c7 100644 (file)
@@ -1368,12 +1368,12 @@ void RenderLayerCompositor::logLayerInfo(const RenderLayer& layer, const char* p
     absoluteBounds.move(layer.offsetFromAncestor(m_renderView.layer()));
     
     StringBuilder logString;
-    logString.flexibleAppend(pad(' ', 12 + depth * 2, hex(reinterpret_cast<uintptr_t>(&layer))), " id ", backing->graphicsLayer()->primaryLayerID(), " (", FormattedNumber::fixedWidth(absoluteBounds.x().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.y().toFloat(), 3), '-', FormattedNumber::fixedWidth(absoluteBounds.maxX().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.maxY().toFloat(), 3), ") ", FormattedNumber::fixedWidth(backing->backingStoreMemoryEstimate() / 1024, 2), "KB");
+    logString.append(pad(' ', 12 + depth * 2, hex(reinterpret_cast<uintptr_t>(&layer))), " id ", backing->graphicsLayer()->primaryLayerID(), " (", FormattedNumber::fixedWidth(absoluteBounds.x().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.y().toFloat(), 3), '-', FormattedNumber::fixedWidth(absoluteBounds.maxX().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.maxY().toFloat(), 3), ") ", FormattedNumber::fixedWidth(backing->backingStoreMemoryEstimate() / 1024, 2), "KB");
 
     if (!layer.renderer().style().hasAutoZIndex())
-        logString.flexibleAppend(" z-index: ", layer.renderer().style().zIndex());
+        logString.append(" z-index: ", layer.renderer().style().zIndex());
 
-    logString.flexibleAppend(" (", logReasonsForCompositing(layer), ") ");
+    logString.append(" (", logReasonsForCompositing(layer), ") ");
 
     if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor() || backing->foregroundLayer() || backing->backgroundLayer()) {
         logString.append('[');
index 2466bfe..243b76f 100644 (file)
@@ -5009,7 +5009,7 @@ String Internals::ongoingLoadsDescriptions() const
         builder.append('[');
 
         for (auto& info : platformStrategies()->loaderStrategy()->intermediateLoadInformationFromResourceLoadIdentifier(identifier))
-            builder.flexibleAppend('[', (int)info.type, ",\"", info.request.url().string(), "\",\"", info.request.httpMethod(), "\",", info.response.httpStatusCode(), ']');
+            builder.append('[', (int)info.type, ",\"", info.request.url().string(), "\",\"", info.request.httpMethod(), "\",", info.response.httpStatusCode(), ']');
 
         builder.append(']');
     }
index 1787440..26efc63 100644 (file)
@@ -1,3 +1,19 @@
+2019-08-17  Sam Weinig  <weinig@apple.com>
+
+        Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
+        https://bugs.webkit.org/show_bug.cgi?id=200756
+
+        Reviewed by Darin Adler.
+
+        Update call sites for rename from StringBuilder::flexibleAppend(...) to 
+        StringBuilder::append(...).
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::dumpHistoryItem):
+        We have to explicitly access the underlying String of the URL rather than
+        relying on the implicit conversion since it is now ambiguous which append(...)
+        overload should be used.
+
 2019-08-17  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: make the initial height bigger when attached
index 01ff1a4..cf1f2d6 100644 (file)
@@ -1870,7 +1870,7 @@ static void dumpHistoryItem(HistoryItem& item, size_t indent, bool isCurrentItem
         stringBuilder.appendLiteral("(file test):");
         stringBuilder.append(url.string().substring(start));
     } else
-        stringBuilder.append(url);
+        stringBuilder.append(url.string());
     
     auto& target = item.target();
     if (target.length()) {
index 8a55e4c..e6c1e5e 100644 (file)
@@ -1,3 +1,16 @@
+2019-08-17  Sam Weinig  <weinig@apple.com>
+
+        Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
+        https://bugs.webkit.org/show_bug.cgi?id=200756
+
+        Reviewed by Darin Adler.
+
+        Update call sites for rename from StringBuilder::flexibleAppend(...) to 
+        StringBuilder::append(...).
+
+        * TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
+        (TestWebKitAPI::TEST):
+
 2019-08-17  Simon Fraser  <simon.fraser@apple.com>
 
         [iOS WK2] Scroll indicators disappear sometimes
index 0c4dc0a..d480955 100644 (file)
@@ -116,25 +116,25 @@ TEST(StringBuilderTest, Append)
     }
 }
 
-TEST(StringBuilderTest, FlexibleAppend)
+TEST(StringBuilderTest, VariadicAppend)
 {
     {
         StringBuilder builder;
-        builder.flexibleAppend(String("0123456789"));
+        builder.append(String("0123456789"));
         expectBuilderContent("0123456789", builder);
-        builder.flexibleAppend("abcd");
+        builder.append("abcd");
         expectBuilderContent("0123456789abcd", builder);
-        builder.flexibleAppend('e');
+        builder.append('e');
         expectBuilderContent("0123456789abcde", builder);
-        builder.flexibleAppend("");
+        builder.append("");
         expectBuilderContent("0123456789abcde", builder);
     }
 
     {
         StringBuilder builder;
-        builder.flexibleAppend(String("0123456789"), "abcd", 'e', "");
+        builder.append(String("0123456789"), "abcd", 'e', "");
         expectBuilderContent("0123456789abcde", builder);
-        builder.flexibleAppend(String("A"), "B", 'C', "");
+        builder.append(String("A"), "B", 'C', "");
         expectBuilderContent("0123456789abcdeABC", builder);
     }
 }