From cf7dddae74ae990c2b46a9feeaea3b7a33ec077d Mon Sep 17 00:00:00 2001 From: Theresa Foley Date: Thu, 2 Sep 2021 16:10:53 -0700 Subject: Two small fixes. (#1928) * Fix mangling logic for the case where a symbol name contains characters that aren't permitted (this usually occurs when a module name consists of the actual path to the module). There were multiple early-out `if` cases that accidentally fell through to the fallback path, so that symbol names would end up being excessively long. * Fix type conversion cost lookup cache, by allowing single-element vectors (e.g., `vector`) and single row/column matrix types to be distinguished from types of lower rank. Previously, `float` and `float1` and `float1x1` would share a single cache entry, even though each (currently) has very different conversion rules. --- source/slang/slang-mangle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-mangle.cpp') diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index 3b65d196d..b0568994f 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -83,11 +83,13 @@ namespace Slang // for (auto c : str) { - if (('a' <= c) && (c <= 'z')) { encoded.append(c); } - if (('A' <= c) && (c <= 'Z')) { encoded.append(c); } - if (('0' <= c) && (c <= '9')) { encoded.append(c); } - - if (c == '_') + if (('a' <= c) && (c <= 'z') + || ('A' <= c) && (c <= 'Z') + || ('0' <= c) && (c <= '9')) + { + encoded.append(c); + } + else if (c == '_') { encoded.append("_u"); } -- cgit v1.2.3