From 068f2a2552ba49335a8a1e72e1731d047335fe82 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 1 Nov 2019 10:31:01 -0400 Subject: -extract-repro gives approximation of 'command line' used (#1103) * Added feature to repro manifest of approximation of command line that was used. * Add missing slang-options.h --- source/slang/slang-compiler.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 705b4ed59..92759ed0f 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -396,23 +396,23 @@ namespace Slang } } - Stage findStageByName(String const& name) + static const struct { - static const struct - { - char const* name; - Stage stage; - } kStages[] = - { - #define PROFILE_STAGE(ID, NAME, ENUM) \ + char const* name; + Stage stage; + } kStages[] = + { + #define PROFILE_STAGE(ID, NAME, ENUM) \ { #NAME, Stage::ID }, #define PROFILE_STAGE_ALIAS(ID, NAME, VAL) \ { #NAME, Stage::ID }, #include "slang-profile-defs.h" - }; + }; + Stage findStageByName(String const& name) + { for(auto entry : kStages) { if(name == entry.name) @@ -424,6 +424,18 @@ namespace Slang return Stage::Unknown; } + UnownedStringSlice getStageText(Stage stage) + { + for (auto entry : kStages) + { + if (stage == entry.stage) + { + return UnownedStringSlice(entry.name); + } + } + return UnownedStringSlice(); + } + static UnownedStringSlice _getPassThroughAsText(PassThroughMode mode) { switch (mode) -- cgit v1.2.3