diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2021-07-27 19:47:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-08-03 14:55:47 (GMT) |
commit | 866b0595f6f3e26542148984e22f508fb1b3eb1e (patch) | |
tree | b20322d97975991d4be792a0edfc1bf29b343b4d /Source/cmConditionEvaluator.h | |
parent | 51d9194a96df4cb8cd144afce4edc6e2122fab2d (diff) | |
download | CMake-866b0595f6f3e26542148984e22f508fb1b3eb1e.zip CMake-866b0595f6f3e26542148984e22f508fb1b3eb1e.tar.gz CMake-866b0595f6f3e26542148984e22f508fb1b3eb1e.tar.bz2 |
Refactor: Introduce `cmArgumentList` container class
The `cmArgumentList` has been turned into a class (forward declared in
the header). It inherits from the `std::list` (yeah, but we don't intend
to store polymorphic classes in it). In addition to the standard methods,
now it's possible to move `HandlePredicate` (renamed to `ReduceOneArg`)
and `HandleBinaryOp` (renamed to `ReduceTwoArgs`) as its members.
Additionally, iterators managements (`IncrementArguments`) have been
refactored into two separate classes mimicking iterators. This also
allows having a uniform `for` loop and concentrates the logic of
iterators advancing in it instead of the loop's body. The arguments
processing algorithms operate with "windows" over a collection of
arguments. Hence there are two kinds of "iteration windows" -- allowing
to observe 2 or 3 elements per loop iteration. These iteration "windows"
also passed to reducers.
Diffstat (limited to 'Source/cmConditionEvaluator.h')
-rw-r--r-- | Source/cmConditionEvaluator.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index 8367007..00d896b 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -4,25 +4,22 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include <list> #include <string> #include <vector> #include <cmext/string_view> -#include "cmExpandedCommandArgument.h" #include "cmListFileCache.h" #include "cmMessageType.h" #include "cmPolicies.h" #include "cmProperty.h" +class cmExpandedCommandArgument; class cmMakefile; class cmConditionEvaluator { public: - using cmArgumentList = std::list<cmExpandedCommandArgument>; - cmConditionEvaluator(cmMakefile& makefile, cmListFileBacktrace bt); // this is a shared function for both If and Else to determine if the @@ -32,6 +29,8 @@ public: std::string& errorString, MessageType& status); private: + class cmArgumentList; + // Filter the given variable definition based on policy CMP0054. cmProp GetDefinitionIfUnquoted( const cmExpandedCommandArgument& argument) const; @@ -51,6 +50,15 @@ private: MessageType& status, bool oneArg = false) const; + 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...); + bool HandleLevel0(cmArgumentList& newArgs, std::string& errorString, MessageType& status); @@ -65,15 +73,6 @@ 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; |