summaryrefslogtreecommitdiffstats
path: root/Source/cmConditionEvaluator.h
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-07-27 03:35:54 (GMT)
committerBrad King <brad.king@kitware.com>2021-08-03 14:55:46 (GMT)
commit46810235e3a8420b3379b352dd6b19d7a0439acd (patch)
tree6516be2a6cbd12222c5426c51adbe6cc3ef6430b /Source/cmConditionEvaluator.h
parent17af3baddd7b7056114748f16e63b8de6b3f67e8 (diff)
downloadCMake-46810235e3a8420b3379b352dd6b19d7a0439acd.zip
CMake-46810235e3a8420b3379b352dd6b19d7a0439acd.tar.gz
CMake-46810235e3a8420b3379b352dd6b19d7a0439acd.tar.bz2
Refactor: Avoid `if` → `else if` → … for compare operators
When trying to match one of compare operator key inside `if()` condition, remember the index of matched operator. Later this index used to select the operation to perform instead of strings compare again.
Diffstat (limited to 'Source/cmConditionEvaluator.h')
-rw-r--r--Source/cmConditionEvaluator.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index d74e28b..8367007 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -65,6 +65,15 @@ private:
bool HandleLevel4(cmArgumentList& newArgs, std::string& errorString,
MessageType& status);
+ template <int N>
+ int matchKeysImpl(const cmExpandedCommandArgument&);
+
+ template <int N, typename T, typename... Keys>
+ int matchKeysImpl(const cmExpandedCommandArgument&, T, Keys...);
+
+ template <typename... Keys>
+ int matchKeys(const cmExpandedCommandArgument&, Keys...);
+
cmMakefile& Makefile;
cmListFileBacktrace Backtrace;
cmPolicies::PolicyStatus Policy12Status;