diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-01-26 16:04:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-26 13:04:44 -0800 |
| commit | 50676c741e10ffe6f710c5de86387eaacd274a9a (patch) | |
| tree | 55e306d241df65af7746e5f8ba593ae72002c704 /source/core | |
| parent | 798d7731eca286df456bc2ec56c0695ba006b472 (diff) | |
Obfuscation naming issue fix (#1676)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Work around for issue with obfuscation (and lack of name hints) leading to names in output not being correctly uniquified.
* Improve appendChar
Remove unrequired memory juggling to scrub names.
* Remove test code.
* Small fixes in comments and method called.
* Remove linkage decoration on functions that are specialized.
* Obfuscation naming with specialization test.
* Fix instruction deletion.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-string.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 6d06eb1c6..4b1ec4c84 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -362,15 +362,25 @@ namespace Slang } } - void String::append(char chr) + void String::appendChar(char c) { - append(&chr, &chr + 1); - } + const auto oldLength = getLength(); + const auto newLength = oldLength + 1; + + ensureUniqueStorageWithCapacity(newLength); + // Since there must be space for at least one character, m_buffer cannot be nullptr + SLANG_ASSERT(m_buffer); + char* data = m_buffer->getData(); + data[oldLength] = c; + data[newLength] = 0; - void String::appendChar(char chr) + m_buffer->length = newLength; + } + + void String::append(char chr) { - append(&chr, &chr + 1); + appendChar(chr); } void String::append(String const& str) |
