diff options
Diffstat (limited to 'source/compiler-core/slang-command-line-args.cpp')
| -rw-r--r-- | source/compiler-core/slang-command-line-args.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/source/compiler-core/slang-command-line-args.cpp b/source/compiler-core/slang-command-line-args.cpp index 813d2dd26..b69836030 100644 --- a/source/compiler-core/slang-command-line-args.cpp +++ b/source/compiler-core/slang-command-line-args.cpp @@ -2,7 +2,8 @@ #include "../core/slang-process-util.h" #include "../core/slang-string-escape-util.h" - +#include "../core/slang-string-util.h" +#include "../core/slang-type-text-util.h" #include "slang-core-diagnostics.h" namespace Slang { @@ -63,6 +64,27 @@ bool CommandLineArgs::hasArgs(const char*const* args, Index count) const return true; } +String CommandLineArgs::serialize() +{ + StringBuilder sb; + for (auto& arg : m_args) + sb << arg.value << "\n"; + return sb.produceString(); +} + +void CommandLineArgs::deserialize(String content) +{ + List<UnownedStringSlice> slices; + StringUtil::split(content.getUnownedSlice(), '\n', slices); + for (auto arg : slices) + { + Arg v; + v.value = arg; + v.loc = SourceLoc(); + m_args.add(v); + } +} + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CommandLineReader @@ -118,6 +140,24 @@ SlangResult CommandLineReader::expectArg(CommandLineArg& outArg) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ +DownstreamArgs::DownstreamArgs(CommandLineContext* context) + : m_context(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) + { + addName(TypeTextUtil::getPassThroughName(SlangPassThrough(i))); + } + + // Generic downstream tool + addName("downstream"); + // Generic downstream linker + addName("linker"); + } +} + + Index DownstreamArgs::addName(const String& name) { Index index = findName(name); |
