summaryrefslogtreecommitdiffstats
path: root/Source/cmConditionEvaluator.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename cmProp in cmValueMarc Chevrier2021-09-211-3/+3
|
* Refactor: Introduce `cmArgumentList` container classAlex Turbov2021-08-031-13/+12
| | | | | | | | | | | | | | | | | 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.
* Refactor: Avoid `if` → `else if` → … for compare operatorsAlex Turbov2021-08-031-0/+9
| | | | | | 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.
* Refactor: Set `const` to `cmConditionEvaluator::IsKeyword` parametersAlex Turbov2021-08-031-1/+1
|
* Refactor: Speedup predicates and binary operationAlex Turbov2021-07-261-1/+1
| | | | | | | | | | Before predicates and binary ops reducers use series of `if ()` blocks to match the keywords. However, if matched the currect `arg` get replaced with evaluation result, so further `if (<match-another-keyword>)` is just wasting time/resources. This patch introduce a chain of `if` → `else if` → ..., so after first match the loop restarts w/ the next argument.
* Refactor: Make `HandleBinaryOp` and `HandlePredicate` free functionsAlex Turbov2021-07-261-10/+0
|
* Refactor: Make `IncrementArguments()` the free functionAlex Turbov2021-07-261-4/+0
| | | | Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
* Refactor: Turn `reducible` flag into booleanAlex Turbov2021-07-261-2/+2
| | | | Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
* Refactor: Use `cm::string_view` for static const literalsAlex Turbov2021-07-261-1/+3
| | | | Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
* cmConditionEvaluator: Remove extra copy of execution contextBrad King2020-09-281-3/+1
| | | | | | The execution context passed to the constructor always matches the top of the backtrace, so the former can be removed in favor of using only the latter.
* cmConditionEvaluator: More use of cmPropvvs314152020-09-081-3/+3
|
* Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-1/+1
|
* clang-tidy: Pass by valueRegina Pfeifer2019-01-221-2/+2
|
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-9/+8
| | | | Reduce the number of files relying on `cmake.h`.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-2/+8
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-0/+2
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-56/+45
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* cmConditionEvaluator: Remove GetConditionContext methodBrad King2016-03-291-3/+0
| | | | | All it does is call cmListFileContext::FromCommandContext, so move this to the call sites.
* cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)Stephen Kelly2015-10-201-1/+8
| | | | | | | | | | | | | | | Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop execution context in favor of a new way to create backtraces. However, a call to cmMakefile::GetExecutionContext is still invoked to issue a contextual CMP0054 warning through cmConditionEvaluator. As the elseif is not part of the call stack, this resulted in trying to access an empty vector. Avoid the attempt at getting execution context when evaluating elseif by constructing a context and backtrace on behalf of the cmConditionEvaluator in all cases.
* if: Add "TEST <test>" conditionMatt McCormick2015-08-031-0/+1
| | | | | | | | if(TEST TestNameThatExists) will return true if a test with the name TestNameThatExists has been added with add_test. The syntax is similar to if(TARGET TargetName). Since use of "TEST" as an argument to if() could previously be interpreted as a non-keyword argument, add policy CMP0064 to treat it as a keyword as NEW behavior.
* if: Implement new IN_LIST operatorNils Gladitz2015-04-301-0/+1
|
* cmStandardIncludes: Remove list include.Stephen Kelly2015-02-061-0/+2
| | | | Include it only where used.
* If: Introduce policy CMP0054 - don't dereference quoted variables in if()Nils Gladitz2014-09-111-7/+13
|
* If: Extract cmConditionEvaluator from if() implementationNils Gladitz2014-09-111-0/+90