From 172538fdb418f7a2faab1f5a410f3b2cb8e18ba5 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 21 May 2021 18:41:54 -0400 Subject: Downstream option handling (#1850) * #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. Co-authored-by: T. Foley --- source/slang/slang.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index d16770a1d..8479a0e99 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -4,6 +4,7 @@ #include "../core/slang-string-util.h" #include "../core/slang-shared-library.h" #include "../core/slang-archive-file-system.h" +#include "../core/slang-type-text-util.h" #include "slang-check.h" #include "slang-parameter-binding.h" @@ -2029,6 +2030,22 @@ 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