summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rwxr-xr-xsource/slang/slang-compiler.cpp7
-rwxr-xr-xsource/slang/slang-compiler.h6
-rw-r--r--source/slang/slang-options.cpp12
-rw-r--r--source/slang/slang.cpp34
4 files changed, 31 insertions, 28 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 31ead4cc3..9a2a69248 100755
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -967,13 +967,14 @@ namespace Slang
/* Let's set the compiler specific options
We can only do this if the endToEndReq is set. */
- if (endToEndReq)
{
+ auto linkage = targetReq->getLinkage();
+
auto name = TypeTextUtil::getPassThroughName((SlangPassThrough)downstreamCompiler);
- const Index nameIndex = endToEndReq->m_downstreamArgs.findName(name);
+ const Index nameIndex = linkage->m_downstreamArgs.findName(name);
if (nameIndex >= 0)
{
- auto& args = endToEndReq->m_downstreamArgs.getArgsAt(nameIndex);
+ auto& args = linkage->m_downstreamArgs.getArgsAt(nameIndex);
for (const auto& arg : args.m_args)
{
options.compilerSpecificArguments.add(arg.value);
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 603ee0bb5..e3d8e506c 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -1349,6 +1349,9 @@ namespace Slang
// Determine whether to output heterogeneity-related code
bool m_heterogeneous = false;
+ /// Holds any args that are destined for downstream compilers/tools etc
+ DownstreamArgs m_downstreamArgs;
+
// Name pool for looking up names
NamePool namePool;
@@ -2036,9 +2039,6 @@ namespace Slang
};
Dictionary<TargetRequest*, RefPtr<TargetInfo>> m_targetInfos;
- /// Holds any args that are destined for downstream compilers/tools etc
- DownstreamArgs m_downstreamArgs;
-
/// Writes the modules in a container to the stream
SlangResult writeContainerToStream(Stream* stream);
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index f4cd2e4ef..00372ca3c 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -410,7 +410,7 @@ struct OptionsParser
DiagnosticSink* requestSink = requestImpl->getSink();
- CommandLineContext* cmdLineContext = requestImpl->m_downstreamArgs.getContext();
+ CommandLineContext* cmdLineContext = requestImpl->getLinkage()->m_downstreamArgs.getContext();
// Why create a new DiagnosticSink?
// We *don't* want the lexer that comes as default (it's for Slang source!)
@@ -437,9 +437,6 @@ struct OptionsParser
parseSink.setFlag(DiagnosticSink::Flag::SourceLocationLine);
}
- // We don't know how big the terminal is.. let's guess 120 for now
- parseSink.setSourceLineMaxLength(120);
-
// All diagnostics will also be sent to requestSink
parseSink.setParentSink(requestSink);
@@ -451,8 +448,11 @@ struct OptionsParser
// Doing so will allocate some SourceLoc space from the CommandLineContext.
args.setArgs(argv, argc);
- // Before we do anything else lets strip out all of the downstream arguments.
- SLANG_RETURN_ON_FAIL(requestImpl->m_downstreamArgs.stripDownstreamArgs(args, 0, sink));
+ {
+ auto linkage = requestImpl->getLinkage();
+ // Before we do anything else lets strip out all of the downstream arguments.
+ SLANG_RETURN_ON_FAIL(linkage->m_downstreamArgs.stripDownstreamArgs(args, 0, sink));
+ }
CommandLineReader reader(&args, sink);
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<CommandLineContext> 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<CommandLineContext> 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()