From 9972a5269f87618e237cd927b859636322596a76 Mon Sep 17 00:00:00 2001 From: aidanfnv Date: Mon, 7 Apr 2025 07:01:50 -0700 Subject: Return non-escaped strings from user-defined attributes (#6735) Fixes #6624 This commit changes the behavior of getArgumentValueString() to return the string's value, instead of returning the string's token, as that token also contains the surrounding quotation marks. This commit also modifies the relevant unit test accordingly, to not check for the surrounding quotations. --- source/slang/slang-reflection-api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 5dfa9d55a..065c2c3f6 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -378,8 +378,8 @@ SLANG_API const char* spReflectionUserAttribute_GetArgumentValueString( if (auto cexpr = as(userAttr->args[index])) { if (bufLen) - *bufLen = cexpr->token.getContentLength(); - return cexpr->token.getContent().begin(); + *bufLen = cexpr->value.getLength(); + return cexpr->value.getBuffer(); } return nullptr; } -- cgit v1.2.3