summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-12-04 13:49:26 -0500
committerGitHub <noreply@github.com>2019-12-04 13:49:26 -0500
commit1e5ec5ca8c73e91c63b787e69c7286728f510b5e (patch)
tree033d61c6df3b3d9567918a34f56c0fdda23bba80 /source/slang/slang-compiler.cpp
parent0b4c1f63226eeff400eaa59be2331f0a480fd7b5 (diff)
Setting downstream compiler (#1144)
* WIP setting downstream compiler. * Setting default downstream compiler for a source type.
Diffstat (limited to 'source/slang/slang-compiler.cpp')
-rw-r--r--source/slang/slang-compiler.cpp42
1 files changed, 13 insertions, 29 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 64be1505e..1385118fc 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -1233,50 +1233,34 @@ SlangResult dissassembleDXILUsingDXC(
{
auto sink = slangRequest->getSink();
+ auto session = slangRequest->getSession();
+
const String originalSourcePath = calcSourcePathForEntryPoint(endToEndReq, entryPointIndex);
outBin.clear();
outSharedLib.setNull();
- CPPCompilerSet* compilerSet = slangRequest->getSession()->requireCPPCompilerSet();
+ PassThroughMode downstreamCompiler = endToEndReq->passThrough;
- // Determine compiler to use
- CPPCompiler* compiler = nullptr;
- switch (endToEndReq->passThrough)
+ // If we are not in pass through, lookup the default compiler for the emitted source type
+ if (downstreamCompiler == PassThroughMode::None)
{
- case PassThroughMode::None:
- case PassThroughMode::GenericCCpp:
- {
- // If there is no pass through... still need a compiler
- compiler = compilerSet->getDefaultCompiler();
- break;
- }
- case PassThroughMode::Clang:
- {
- compiler = CPPCompilerUtil::findCompiler(compilerSet, CPPCompilerUtil::MatchType::Newest, CPPCompiler::Desc(CPPCompiler::CompilerType::Clang));
- break;
- }
- case PassThroughMode::VisualStudio:
- {
- compiler = CPPCompilerUtil::findCompiler(compilerSet, CPPCompilerUtil::MatchType::Newest, CPPCompiler::Desc(CPPCompiler::CompilerType::VisualStudio));
- break;
- }
- case PassThroughMode::Gcc:
- {
- compiler = CPPCompilerUtil::findCompiler(compilerSet, CPPCompilerUtil::MatchType::Newest, CPPCompiler::Desc(CPPCompiler::CompilerType::GCC));
- break;
- }
+ downstreamCompiler = PassThroughMode(session->getDefaultDownstreamCompiler(SLANG_SOURCE_LANGUAGE_CPP));
}
+
+ // Get the required downstream CPP compiler
+ CPPCompiler* compiler = session->getCPPCompiler(downstreamCompiler);
if (!compiler)
{
- if (endToEndReq->passThrough != PassThroughMode::None)
+ auto compilerName = _getPassThroughAsText(downstreamCompiler);
+ if (downstreamCompiler != PassThroughMode::None)
{
- sink->diagnose(SourceLoc(), Diagnostics::passThroughCompilerNotFound, _getPassThroughAsText(endToEndReq->passThrough));
+ sink->diagnose(SourceLoc(), Diagnostics::passThroughCompilerNotFound, compilerName);
}
else
{
- sink->diagnose(SourceLoc(), Diagnostics::cppCompilerNotFound);
+ sink->diagnose(SourceLoc(), Diagnostics::cppCompilerNotFound, compilerName);
}
return SLANG_FAIL;
}