Removed StringFragment alias in favor of skstd::string_view
Change-Id: I026a8a6b452d4cb8adce4d5d4908aaf2e71f2555
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417516
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
index c8bc3b2..99ccb1b 100644
--- a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
@@ -38,13 +38,13 @@
class MetalCodeGenerator::GlobalStructVisitor {
public:
virtual ~GlobalStructVisitor() = default;
- virtual void visitInterfaceBlock(const InterfaceBlock& block, StringFragment blockName) = 0;
- virtual void visitTexture(const Type& type, StringFragment name) = 0;
- virtual void visitSampler(const Type& type, StringFragment name) = 0;
+ virtual void visitInterfaceBlock(const InterfaceBlock& block, skstd::string_view blockName) = 0;
+ virtual void visitTexture(const Type& type, skstd::string_view name) = 0;
+ virtual void visitSampler(const Type& type, skstd::string_view name) = 0;
virtual void visitVariable(const Variable& var, const Expression* value) = 0;
};
-void MetalCodeGenerator::write(StringFragment s) {
+void MetalCodeGenerator::write(skstd::string_view s) {
if (s.empty()) {
return;
}
@@ -57,7 +57,7 @@
fAtLineStart = false;
}
-void MetalCodeGenerator::writeLine(StringFragment s) {
+void MetalCodeGenerator::writeLine(skstd::string_view s) {
this->write(s);
fOut->writeText(fLineEnding);
fAtLineStart = true;
@@ -1860,7 +1860,7 @@
this->writeExpression(value, Precedence::kTopLevel);
}
-void MetalCodeGenerator::writeName(StringFragment name) {
+void MetalCodeGenerator::writeName(skstd::string_view name) {
if (fReservedWords.find(name) != fReservedWords.end()) {
this->write("_"); // adding underscore before name to avoid conflict with reserved words
}
@@ -2210,7 +2210,8 @@
void MetalCodeGenerator::writeGlobalStruct() {
class : public GlobalStructVisitor {
public:
- void visitInterfaceBlock(const InterfaceBlock& block, StringFragment blockName) override {
+ void visitInterfaceBlock(const InterfaceBlock& block,
+ skstd::string_view blockName) override {
this->addElement();
fCodeGen->write(" constant ");
fCodeGen->write(block.typeName());
@@ -2218,7 +2219,7 @@
fCodeGen->writeName(blockName);
fCodeGen->write(";\n");
}
- void visitTexture(const Type& type, StringFragment name) override {
+ void visitTexture(const Type& type, skstd::string_view name) override {
this->addElement();
fCodeGen->write(" ");
fCodeGen->writeType(type);
@@ -2226,7 +2227,7 @@
fCodeGen->writeName(name);
fCodeGen->write(";\n");
}
- void visitSampler(const Type&, StringFragment name) override {
+ void visitSampler(const Type&, skstd::string_view name) override {
this->addElement();
fCodeGen->write(" sampler ");
fCodeGen->writeName(name);
@@ -2267,16 +2268,16 @@
class : public GlobalStructVisitor {
public:
void visitInterfaceBlock(const InterfaceBlock& blockType,
- StringFragment blockName) override {
+ skstd::string_view blockName) override {
this->addElement();
fCodeGen->write("&");
fCodeGen->writeName(blockName);
}
- void visitTexture(const Type&, StringFragment name) override {
+ void visitTexture(const Type&, skstd::string_view name) override {
this->addElement();
fCodeGen->writeName(name);
}
- void visitSampler(const Type&, StringFragment name) override {
+ void visitSampler(const Type&, skstd::string_view name) override {
this->addElement();
fCodeGen->writeName(name);
}