diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-03-10 11:02:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-10 09:02:39 +0000 |
| commit | 5673edfe3602a6585a925dfc555b90f0b68e328d (patch) | |
| tree | 74c10bd7ec5978723388c5fef83a331ea85625c6 /source | |
| parent | b59d15539d65472c0e5a89e390ad02b98da61e95 (diff) | |
Add module reference options to options list when parsing them (#6539)
* Add module reference options to options list when parsing them
Previously, the module was just added to the compile request directly.
This is a problem because the non-deprecated command line option parsing interface
IGlobalSession::parseCommandLineArguments just creates a temporary compile request.
Therefore these options are currently not detected by the API.
This helps to address issue #4760 since it will need to access these modules in order to
supply all of the required code.
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-options.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index ed7e79aa3..ed2424224 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -1831,7 +1831,20 @@ SlangResult OptionsParser::_parseReferenceModule(const CommandLineArg& arg) CommandLineArg referenceModuleName; SLANG_RETURN_ON_FAIL(m_reader.expectArg(referenceModuleName)); - return addReferencedModule(referenceModuleName.value, referenceModuleName.loc, true); + // Add the module to the request + SLANG_RETURN_ON_FAIL( + addReferencedModule(referenceModuleName.value, referenceModuleName.loc, true)); + + // In addition to adding the module to the request, we also add to the options set, because + // the same options parser is also used for IGlobalSession::parseCommandLineArguments, which + // parses options via a dummy request that is destroyed once the command line options are + // obtained. Therefore, also add the option here so that + // IGlobalSession::parseCommandLineArguments can return them. + m_requestImpl->getLinkage()->m_optionSet.add( + CompilerOptionName::ReferenceModule, + referenceModuleName.value); + + return SLANG_OK; } SlangResult OptionsParser::_parseReproFileSystem(const CommandLineArg& arg) |
