summaryrefslogtreecommitdiffstats
path: root/source/slangc/main.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-26 16:39:51 -0700
committerGitHub <noreply@github.com>2023-03-26 16:39:51 -0700
commitffa7d05e898492aa1120f8747332a72ca5befc56 (patch)
tree753000a0a927a4eb046f832aeca2313a207c9ac3 /source/slangc/main.cpp
parentd64ee86a3130f8eeb75d09193c38c621d7565eba (diff)
Update slang-llvm (#2735)
Diffstat (limited to 'source/slangc/main.cpp')
-rw-r--r--source/slangc/main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slangc/main.cpp b/source/slangc/main.cpp
index 2fe9d19a1..3a01c07e7 100644
--- a/source/slangc/main.cpp
+++ b/source/slangc/main.cpp
@@ -66,6 +66,16 @@ static SlangResult _compile(SlangCompileRequest* compileRequest, int argc, const
return res;
}
+bool shouldEmbedPrelude(const char* const* argv, int argc)
+{
+ for (int i = 0; i < argc; i++)
+ {
+ if (UnownedStringSlice(argv[i]) == "-embed-prelude")
+ return true;
+ }
+ return false;
+}
+
SLANG_TEST_TOOL_API SlangResult innerMain(StdWriters* stdWriters, slang::IGlobalSession* sharedSession, int argc, const char*const* argv)
{
StdWriters::setSingleton(stdWriters);
@@ -86,7 +96,8 @@ SLANG_TEST_TOOL_API SlangResult innerMain(StdWriters* stdWriters, slang::IGlobal
SLANG_RETURN_ON_FAIL(slang_createGlobalSession(SLANG_API_VERSION, session.writeRef()));
}
- TestToolUtil::setSessionDefaultPreludeFromExePath(argv[0], session);
+ if (!shouldEmbedPrelude(argv, argc))
+ TestToolUtil::setSessionDefaultPreludeFromExePath(argv[0], session);
SlangCompileRequest* compileRequest = spCreateCompileRequest(session);
compileRequest->addSearchPath(Path::getParentDirectory(Path::getExecutablePath()).getBuffer());