summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-04-30 10:47:10 -0700
committerGitHub <noreply@github.com>2024-04-30 10:47:10 -0700
commit492f56e02fe9e9902eabefaa34f5b2fc9778dd47 (patch)
tree7bbef87fd9b0b117f01a1d34227bbd02f227f783 /source/slang/slang-options.cpp
parentf1221b80c3c5f59ed533147825ea414bef5e9df2 (diff)
Add option -disable-short-circuit (#4054)
Add option -disable-short-circuit to disable short circuit for logic operators && and ||. Also, disable the short circuit by default in the stdlib.
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index dad69350e..7337b9210 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -343,6 +343,7 @@ void initCommandOptions(CommandOptions& options)
"The name used as the basis for variables output for source embedding."},
{ OptionKind::SourceEmbedLanguage, "-source-embed-language", "-source-embed-language <language>",
"The language to be used for source embedding. Defaults to C/C++. Currently only C/C++ are supported"},
+ { OptionKind::DisableShortCircuit, "-disable-short-circuit", nullptr, "Disable short-circuiting for \"&&\" and \"||\" operations" },
};
_addOptions(makeConstArrayView(generalOpts), options);
@@ -2298,6 +2299,11 @@ SlangResult OptionsParser::_parse(
break;
}
+ case OptionKind::DisableShortCircuit:
+ {
+ linkage->m_optionSet.add(OptionKind::DisableShortCircuit, true);
+ break;
+ }
default:
{
// Hmmm, we looked up and produced a valid enum, but it wasn't handled in the switch...