Add SkSL DSLVar

Change-Id: I1093aa6bbdb481c98ea3dab10c06bfcf323b2a75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352058
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/dsl/priv/DSLWriter.h b/src/sksl/dsl/priv/DSLWriter.h
index 77becd9..3fb8612 100644
--- a/src/sksl/dsl/priv/DSLWriter.h
+++ b/src/sksl/dsl/priv/DSLWriter.h
@@ -8,6 +8,7 @@
 #ifndef SKSL_DSLWRITER
 #define SKSL_DSLWRITER
 
+#include "src/sksl/SkSLMangler.h"
 #include "src/sksl/dsl/DSLExpression.h"
 #include "src/sksl/ir/SkSLExpressionStatement.h"
 #include "src/sksl/ir/SkSLProgram.h"
@@ -63,6 +64,18 @@
     static const std::shared_ptr<SkSL::SymbolTable>& SymbolTable();
 
     /**
+     * Returns the final pointer to a pooled Modifiers object that should be used to represent the
+     * given modifiers.
+     */
+    static const SkSL::Modifiers* Modifiers(SkSL::Modifiers modifiers);
+
+    /**
+     * Returns the (possibly mangled) final name that should be used for an entity with the given
+     * raw name.
+     */
+    static const char* Name(const char* name);
+
+    /**
      * Reports an error if the argument is null. Returns its argument unmodified.
      */
     static std::unique_ptr<SkSL::Expression> Check(std::unique_ptr<SkSL::Expression> expr);
@@ -84,6 +97,13 @@
      */
     static void ReportError(const char* msg);
 
+    /**
+     * Returns whether name mangling is enabled. This should always be enabled outside of tests.
+     */
+    static bool ManglingEnabled() {
+        return Instance().fMangle;
+    }
+
     static DSLWriter& Instance();
 
     static void SetInstance(std::unique_ptr<DSLWriter> instance);
@@ -92,6 +112,8 @@
     SkSL::Program::Settings fSettings;
     SkSL::Compiler* fCompiler;
     ErrorHandler* fErrorHandler = nullptr;
+    bool fMangle = true;
+    Mangler fMangler;
 
     friend class DSLCore;
     friend class ::AutoDSLContext;