diff options
Diffstat (limited to 'source/slang/slang-parser.cpp')
| -rw-r--r-- | source/slang/slang-parser.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index d64329add..4522f977d 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -84,6 +84,7 @@ namespace Slang bool enableEffectAnnotations = false; bool allowGLSLInput = false; bool isInLanguageServer = false; + CompilerOptionSet optionSet; }; // TODO: implement two pass parsing for file reference and struct type recognition @@ -3207,7 +3208,20 @@ namespace Slang else { // Otherwise, we need to generate a name for the buffer variable. - bufferVarDecl->nameAndLoc.name = generateName(parser, "parameterGroup_" + String(reflectionNameToken.getContent())); + if (parser->options.optionSet.getBoolOption(CompilerOptionName::NoMangle)) + { + // If no-mangle option is set, use the reflection name as the variable name, + // and mark all members of the buffer object as no mangle. + bufferVarDecl->nameAndLoc.name = reflectionNameToken.getName(); + for (auto m : bufferDataTypeDecl->getMembersOfType<VarDecl>()) + { + addModifier(m, parser->astBuilder->create<ExternCppModifier>()); + } + } + else + { + bufferVarDecl->nameAndLoc.name = generateName(parser, "parameterGroup_" + String(reflectionNameToken.getContent())); + } // We also need to make the declaration "transparent" so that their // members are implicitly made visible in the parent scope. @@ -7546,6 +7560,7 @@ namespace Slang translationUnit->compileRequest->optionSet.getBoolOption(CompilerOptionName::AllowGLSL) || sourceLanguage == SourceLanguage::GLSL; options.isInLanguageServer = translationUnit->compileRequest->getLinkage()->isInLanguageServer(); + options.optionSet = translationUnit->compileRequest->optionSet; Parser parser(astBuilder, tokens, sink, outerScope, options); parser.namePool = translationUnit->getNamePool(); |
