summaryrefslogtreecommitdiffstats
path: root/source/slangc/main.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/slangc/main.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/slangc/main.cpp')
-rw-r--r--source/slangc/main.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/source/slangc/main.cpp b/source/slangc/main.cpp
index 75e68ce58..2090b0412 100644
--- a/source/slangc/main.cpp
+++ b/source/slangc/main.cpp
@@ -17,22 +17,21 @@ using namespace Slang;
#define MAIN main
#endif
-static void _diagnosticCallback(
- char const* message,
- void* /*userData*/)
+static void _diagnosticCallback(char const* message, void* /*userData*/)
{
auto stdError = StdWriters::getError();
stdError.put(message);
stdError.flush();
}
-static SlangResult _compile(SlangCompileRequest* compileRequest, int argc, const char*const* argv)
+static SlangResult _compile(SlangCompileRequest* compileRequest, int argc, const char* const* argv)
{
spSetDiagnosticCallback(compileRequest, &_diagnosticCallback, nullptr);
spSetCommandLineCompilerMode(compileRequest);
char const* appName = "slangc";
- if (argc > 0) appName = argv[0];
+ if (argc > 0)
+ appName = argv[0];
{
const SlangResult res = spProcessCommandLineArguments(compileRequest, &argv[1], argc - 1);
@@ -49,10 +48,12 @@ static SlangResult _compile(SlangCompileRequest* compileRequest, int argc, const
try
#endif
{
- // Run the compiler (this will produce any diagnostics through SLANG_WRITER_TARGET_TYPE_DIAGNOSTIC).
+ // Run the compiler (this will produce any diagnostics through
+ // SLANG_WRITER_TARGET_TYPE_DIAGNOSTIC).
res = spCompile(compileRequest);
// If the compilation failed, then get out of here...
- // Turn into an internal Result -> such that return code can be used to vary result to match previous behavior
+ // Turn into an internal Result -> such that return code can be used to vary result to match
+ // previous behavior
res = SLANG_FAILED(res) ? SLANG_E_INTERNAL_FAIL : res;
}
#ifndef _DEBUG
@@ -76,7 +77,11 @@ bool shouldEmbedPrelude(const char* const* argv, int argc)
return false;
}
-SLANG_TEST_TOOL_API SlangResult innerMain(StdWriters* stdWriters, slang::IGlobalSession* sharedSession, int argc, const char*const* argv)
+SLANG_TEST_TOOL_API SlangResult innerMain(
+ StdWriters* stdWriters,
+ slang::IGlobalSession* sharedSession,
+ int argc,
+ const char* const* argv)
{
StdWriters::setSingleton(stdWriters);
@@ -85,10 +90,12 @@ SLANG_TEST_TOOL_API SlangResult innerMain(StdWriters* stdWriters, slang::IGlobal
// The sharedSession always has a pre-loaded core module, is sharedSession is not nullptr.
// This differed test checks if the command line has an option to setup the core module.
- // If so we *don't* use the sharedSession, and create a new session without the core module just for this compilation.
+ // If so we *don't* use the sharedSession, and create a new session without the core module just
+ // for this compilation.
if (TestToolUtil::hasDeferredCoreModule(Index(argc - 1), argv + 1))
{
- SLANG_RETURN_ON_FAIL(slang_createGlobalSessionWithoutCoreModule(SLANG_API_VERSION, session.writeRef()));
+ SLANG_RETURN_ON_FAIL(
+ slang_createGlobalSessionWithoutCoreModule(SLANG_API_VERSION, session.writeRef()));
}
else if (!session)
{
@@ -126,17 +133,17 @@ int wmain(int argc, wchar_t** argv)
// since that is what Slang expects on the API side.
List<String> args;
- for(int ii = 0; ii < argc; ++ii)
+ for (int ii = 0; ii < argc; ++ii)
{
args.add(String::fromWString(argv[ii]));
}
List<char const*> argBuffers;
- for(int ii = 0; ii < argc; ++ii)
+ for (int ii = 0; ii < argc; ++ii)
{
argBuffers.add(args[ii].getBuffer());
}
- result = MAIN(argc, (char**) &argBuffers[0]);
+ result = MAIN(argc, (char**)&argBuffers[0]);
}
#ifdef _MSC_VER