summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 093e2599f..c117dbc14 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -1772,7 +1772,13 @@ namespace Slang
parentAggTypeDecl->unionTagsWith(getTypeTags(varDeclRefType));
}
}
-
+ if (getOptionSet().getBoolOption(CompilerOptionName::NoMangle) &&
+ isGlobalDecl(varDecl))
+ {
+ // If -no-mangle option is set, we will add `ExternCpp` modifier to all
+ // global variables and struct fields to prevent mangling.
+ addModifier(varDecl, m_astBuilder->create<ExternCppModifier>());
+ }
checkVisibility(varDecl);
}