From 1a40819995a1089db8942cad7e770bda85cc0b77 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:15:11 -0700 Subject: Do not mangle the name of identifiers when __extern_cpp is added (#4052) Do not mange the name of identifiers decorated by "__extern_cpp". For a slang files that are included by the library module and entry point module, slang could generated two different mangled names for the same functions, because the function with a struct parameter will make the mangled function name contains the file name. Therefore, we allow using "__extern_cpp" on such struct, such that no file name is associated in the mangled name. --- source/slang/slang-mangle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source') diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index d72644c9f..ad1a9caca 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -383,6 +383,12 @@ namespace Slang } } + if (declRef.getDecl()->hasModifier()) + { + emit(context, declRef.getDecl()->getName()->text); + return; + } + auto parentDeclRef = declRef.getParent(); if (as(parentDeclRef)) parentDeclRef = parentDeclRef.getParent(); -- cgit v1.2.3