From 5952e3b3d7f505a7e6d71ecd0793911224f5bac3 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 18 Jun 2020 16:39:06 -0400 Subject: Prelude is associated with SourceLanguage (#1398) * Associate a downstream compiler for prelude lookup even if output is source. * Remove LanguageStyle and just use SourceLanguage instread. * Added set/getPrelude. Made prelude work on source language. * Fix typo in method name replacement. get/SetPrelude get/setLanguagePrelude * Fix issue because of method name change. * Remove getPreludeDownstreamCompilerForTarget --- source/core/slang-test-tool-util.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'source/core') diff --git a/source/core/slang-test-tool-util.cpp b/source/core/slang-test-tool-util.cpp index 3b89321a1..f8e163758 100644 --- a/source/core/slang-test-tool-util.cpp +++ b/source/core/slang-test-tool-util.cpp @@ -59,19 +59,9 @@ static SlangResult _addCPPPrelude(const String& parentPath, slang::IGlobalSessio { String includePath; SLANG_RETURN_ON_FAIL(_calcIncludePath(parentPath, "../../../prelude/slang-cpp-prelude.h", includePath)); - StringBuilder prelude; prelude << "#include \"" << includePath << "\"\n\n"; - const SlangPassThrough downstreamCompilers[] = { - SLANG_PASS_THROUGH_CLANG, ///< Clang C/C++ compiler - SLANG_PASS_THROUGH_VISUAL_STUDIO, ///< Visual studio C/C++ compiler - SLANG_PASS_THROUGH_GCC, ///< GCC C/C++ compiler - SLANG_PASS_THROUGH_GENERIC_C_CPP, - }; - for (auto downstreamCompiler : downstreamCompilers) - { - session->setDownstreamCompilerPrelude(downstreamCompiler, prelude.getBuffer()); - } + session->setLanguagePrelude(SLANG_SOURCE_LANGUAGE_CPP, prelude.getBuffer()); return SLANG_OK; } @@ -79,16 +69,9 @@ static SlangResult _addCUDAPrelude(const String& parentPath, slang::IGlobalSessi { String includePath; SLANG_RETURN_ON_FAIL(_calcIncludePath(parentPath, "../../../prelude/slang-cuda-prelude.h", includePath)); - StringBuilder prelude; prelude << "#include \"" << includePath << "\"\n\n"; - const SlangPassThrough downstreamCompilers[] = { - SLANG_PASS_THROUGH_NVRTC, ///< nvrtc CUDA compiler - }; - for (auto downstreamCompiler : downstreamCompilers) - { - session->setDownstreamCompilerPrelude(downstreamCompiler, prelude.getBuffer()); - } + session->setLanguagePrelude(SLANG_SOURCE_LANGUAGE_CUDA, prelude.getBuffer()); return SLANG_OK; } -- cgit v1.2.3