Remove a leading $ during name mangling.
If SkSL inlined a private function, its name mangled version was coming out as `_123_$function` which isn't a legal symbol name. Change-Id: I2317731479b31c2edf6ff7e34997807dc8a0c488 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526459 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
a990ef91b3
commit
3ff3c662b5
@ -18,6 +18,12 @@ namespace SkSL {
|
|||||||
|
|
||||||
std::string Mangler::uniqueName(std::string_view baseName, SymbolTable* symbolTable) {
|
std::string Mangler::uniqueName(std::string_view baseName, SymbolTable* symbolTable) {
|
||||||
SkASSERT(symbolTable);
|
SkASSERT(symbolTable);
|
||||||
|
|
||||||
|
// Private names might begin with a $. Strip that off.
|
||||||
|
if (skstd::starts_with(baseName, '$')) {
|
||||||
|
baseName.remove_prefix(1);
|
||||||
|
}
|
||||||
|
|
||||||
// The inliner runs more than once, so the base name might already have been mangled and have a
|
// The inliner runs more than once, so the base name might already have been mangled and have a
|
||||||
// prefix like "_123_x". Let's strip that prefix off to make the generated code easier to read.
|
// prefix like "_123_x". Let's strip that prefix off to make the generated code easier to read.
|
||||||
if (skstd::starts_with(baseName, '_')) {
|
if (skstd::starts_with(baseName, '_')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user