summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-04-29 10:15:11 -0700
committerGitHub <noreply@github.com>2024-04-29 10:15:11 -0700
commit1a40819995a1089db8942cad7e770bda85cc0b77 (patch)
tree77ed267feea7968f98057187e8c9be4836fb45b6 /source
parent30b82abc37fd512efb12632da21bed3654d594a8 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-mangle.cpp6
1 files changed, 6 insertions, 0 deletions
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<ExternCppModifier>())
+ {
+ emit(context, declRef.getDecl()->getName()->text);
+ return;
+ }
+
auto parentDeclRef = declRef.getParent();
if (as<FileDecl>(parentDeclRef))
parentDeclRef = parentDeclRef.getParent();