From 34a1ff5226a526cc17c5baecd63637f69c324fc7 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Sat, 22 May 2021 16:03:30 -0400 Subject: Improvements in -X support (#1852) * #include an absolute path didn't work - because paths were taken to always be relative. * Added SourceLoc handling for command line parsing. * Fix typo in debug. * Fix issue around the DiagnosticSink used in options parsing not having a writer available - by having DiagnosticSink parenting. * Small rename for clarity. * WIP extracting command line args for downstream tools. * Unit tests/bug fixes around extracting args. * Use DownstreamArgs in the EndToEndCompileRequest * Passing downstream compiler options downstream. * Fix issue with endToEndReq being nullptr. * Fix issue with diagnostics number change. * Small improvements to how the source line is displayed if it's too long. Default to 120, as suggested in previous review. * Make render test use x-args parsing and CommandArgReader. * Added missing diagnostics. * More DownstreamArgs to linkage so can be seen by 'components'. Added dxc-x-arg test. * Used combination of name and args instead of two Lists, which whilst equivalent was perhaps a little confusing. * Added documentation for -X support. * Added test for x-args parsing diagnostic. Improved diagnostic with list of known names. * Fix issues from merge. * Fix lookup for -matrix-layout-column-major in render test. * Remove commented out line. --- source/slang/slang.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 9a109f9d7..613992354 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -731,6 +731,24 @@ Linkage::Linkage(Session* session, ASTBuilder* astBuilder, Linkage* builtinLinka mapNameToLoadedModules.Add(pair.Key, pair.Value); } } + + { + RefPtr context = new CommandLineContext; + m_downstreamArgs = DownstreamArgs(context); + + // Add all of the possible names we allow for downstream tools + { + for (Index i = SLANG_PASS_THROUGH_NONE + 1; i < SLANG_PASS_THROUGH_COUNT_OF; ++i) + { + m_downstreamArgs.addName(TypeTextUtil::getPassThroughName(SlangPassThrough(i))); + } + + // Generic downstream tool + m_downstreamArgs.addName("downstream"); + // Generic downstream linker + m_downstreamArgs.addName("linker"); + } + } } ISlangUnknown* Linkage::getInterface(const Guid& guid) @@ -2047,22 +2065,6 @@ void EndToEndCompileRequest::init() m_frontEndReq = new FrontEndCompileRequest(getLinkage(), m_writers, getSink()); m_backEndReq = new BackEndCompileRequest(getLinkage(), getSink()); - - RefPtr context = new CommandLineContext; - m_downstreamArgs = DownstreamArgs(context); - - // Add all of the possible names we allow for downstream tools - { - for (Index i = SLANG_PASS_THROUGH_NONE + 1; i < SLANG_PASS_THROUGH_COUNT_OF; ++i) - { - m_downstreamArgs.addName(TypeTextUtil::getPassThroughName(SlangPassThrough(i))); - } - - // Generic downstream tool - m_downstreamArgs.addName("downstream"); - // Generic downstream linker - m_downstreamArgs.addName("linker"); - } } SlangResult EndToEndCompileRequest::executeActionsInner() -- cgit v1.2.3