summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-2/+3
| | | | | | | | | | | | | | Provide a standardized way to handle the C++ "standard" headers customized to be used with current CMake C++ standard constraints. Offer under directory `cm` headers which can be used as direct replacements of the standard ones. For example: #include <cm/string_view> can be used safely for CMake development in place of the `<string_view>` standard header. Fixes: #19491
* clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-2/+1
| | | | | | Set the MinTypeNameLength option to an impossibly high value in order to limit the diagnostics to iterators. Leave new expressions and cast expressions for later.
* Source sweep: Replace std::ostringstream when used with a single appendSebastian Holtermann2019-08-231-3/+1
| | | | | | | This replaces `std::ostringstream`, when it is written to only once. If the single written argument was numeric, `std::to_string` is used instead. Otherwise, the single written argument is used directly instead of the `std::ostringstream::str()` invocation.
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* cmCommand refactor: cmFunctionCommandGabor Bencze2019-08-201-4/+7
|
* cmFunctionBlocker: Recycle functionsRegina Pfeifer2019-07-311-3/+3
|
* cmFunctionBlocker: Move check for matching argsRegina Pfeifer2019-07-301-16/+9
|
* cmFunctionBlocker: Move common logic to baseRegina Pfeifer2019-07-301-28/+7
|
* cm*FunctionBlocker: Extract function ReplayRegina Pfeifer2019-07-301-11/+19
|
* cm*FunctionBlocker: Move to source fileRegina Pfeifer2019-07-301-0/+14
|
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-0/+1
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* cmMakefile: Let AddDefinition accept a value as cm::string_viewSebastian Holtermann2019-07-241-5/+5
| | | | | | | | | | | | | | | | This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value argument instead of a `const char *`. Benefits are: - `std::string` can be passed to `cmMakefile::AddDefinition` directly without the `c_str()` plus string length recomputation fallback. - Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at compile time. In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid `std::string::c_str` calls and the `std::string` is passed directly. Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
* cmState: Add scripted commands by valueRegina Pfeifer2019-07-211-47/+27
|
* cmCommand: deprecate functions GetMakefile and SetErrorDaniel Pfeifer2019-07-211-1/+1
| | | | | | | | | Replace the members for the Makefile and the Error with a cmExecutionStatus. Re-implement GetMakefile and SetError based on that. Both functions should be called directly on the cmExecutionStatus that is passed to InitialPass. This will help us make all Commands immutable and remove the need for cloning.
* cmMakefile: Modernize AddFunctionBlocker method to accept a std::unique_ptrSebastian Holtermann2019-07-171-3/+5
|
* modernize: manage cmCommand instances using unique_ptr.Marc Chevrier2019-07-141-5/+8
|
* Use cmAppend to append ranges to std::vector instancesSebastian Holtermann2019-05-231-1/+1
|
* cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-0/+1
|
* cleanup: Prefer compiler provided special member functionsRegina Pfeifer2019-01-251-5/+0
|
* clang-tidy: Use `= default`Regina Pfeifer2019-01-251-2/+2
| | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* Revise implementation of case-insensitive command namesFlorian Jacomme2018-05-221-4/+3
| | | | | | | | | | | | | | | | | | | | Store both the as-written and lower-case command names and use the latter to avoid case-insensitive string comparisons. With this I obtain 2-6% speed increase (on Windows) for the configure step with no significant changes in memory usage. A case-insensitive comparison is a lot slower than just calling `==` because the operator will use things like memcmp, so prefer the latter. The `cmSystemTools::LowerCase` function allocates a new string each time it is called, so before this change we were allocating in: * cmMakefile::Configure two times for each function (to look for `cmake_minimum_required` and `project`) * cmMakefile::ExecuteCommand twice by function by calling cmState::GetCommand and copying the name Now we are only allocating once by function instead of four.
* Use C++11 override instead of CM_OVERRIDEBrad King2017-09-151-4/+4
| | | | | | | | We now require C++11 support including `override`. Drop use of the old compatibility macro. Convert references as follows: git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' | xargs sed -i 's/CM_OVERRIDE/override/g'
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-2/+2
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* cmCommand: remove unused methods from interface and all implementationsDaniel Pfeifer2017-05-111-10/+0
|
* cmState: introduce method for adding scripted commandsDaniel Pfeifer2017-05-111-5/+1
|
* Merge topic 'dead-code-removal'Brad King2017-05-111-1/+1
|\ | | | | | | | | | | | | | | | | fdd341eb cmFindCommon: remove unused function SetMakefile 67a8d907 cmExecutionStatus: Remove arguments from setters 0c519c70 bootstrap: Remove leftovers from cmBootstrapCommands Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !821
| * cmExecutionStatus: Remove arguments from settersDaniel Pfeifer2017-05-091-1/+1
| | | | | | | | | | The setters are only used to set boolean values. The values are never reset individually.
* | cmCommand: remove IsScriptableDaniel Pfeifer2017-05-081-5/+0
|/
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-1/+0
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-1/+7
|
* Merge topic 'remove-cmobject-uses'Brad King2016-10-241-7/+2
|\ | | | | | | | | | | | | | | | | 2214011f Make cmCPackGenerator not inherit from cmObject 7f9a8d53 Make cmCPackGeneratorFactory not inherit from cmObject fb0b087c Make cmCTestGenericHandler not inherit from cmObject 2169b0fa Make cmCPackLog not inherit from cmObject 9855ebf1 Make cmCommand not inherit from cmObject
| * Make cmCommand not inherit from cmObjectDaniel Pfeifer2016-10-221-7/+2
| |
* | Separate compilation for commands included in cmBootstrapCommands1Daniel Pfeifer2016-10-211-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.
* Avoid else after returnDaniel Pfeifer2016-09-161-3/+2
|
* use empty method to check for emptynessDaniel Pfeifer2016-09-151-1/+1
|
* cmMakefile: Restore nested error logic use of cmExecutionStatusBrad King2016-09-061-3/+3
| | | | | | | | | | | | | | Since commit 14a8d61f (cmMakefile: Port nested error logic away from cmExecutionStatus) we fail to continue processing function and macro bodies after non-fatal errors. A non-fatal error should not stop foreach loops, macro bodies, nested bodies, or the outer script. Add a test covering these cases, and revert the change to fix them. Also revert commit 2af853de (cmMakefile: Simplify IssueMessage implementation) because the assertion it added (which was removed by the above commit and is restored by reverting it) is incorrect. We do have code paths that call cmMakefile::IssueMessage with an empty execution stack, such as in CheckForUnusedVariables's LogUnused call.
* cmMakefile: Port nested error logic away from cmExecutionStatusStephen Kelly2016-08-251-3/+3
| | | | It is no longer needed.
* mark functions with CM_OVERRIDEDaniel Pfeifer2016-06-271-8/+9
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-68/+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.
* cmAlgorithms: Rename cmRange to cmMakeRange.Stephen Kelly2015-07-221-1/+1
|
* cmState: Store execution context.Stephen Kelly2015-07-051-0/+1
| | | | | Extend snapshot creation API to store the file being executed and the entry point to get to that context.
* cmListFileArgument: Remove FilePath member.Stephen Kelly2015-06-211-11/+0
| | | | It is now unused.
* cmMakefile: Add filename context to ExpandArguments.Stephen Kelly2015-06-211-1/+2
| | | | | | | | | The cmListFileArgument currently stores a FilePath for use in this method. The filename is the same as the CMAKE_CURRENT_LIST_FILE, except if executing a macro or function defined in another file. Set the context filename when expanding the arguments of macros and functions using the filename recorded when defining the prototype.
* cmFunctionCommand: Store the FilePath when creating the prototype.Stephen Kelly2015-06-211-0/+3
|
* cmMakefile: Create a unified raii for function scopes.Stephen Kelly2015-06-041-11/+3
|
* Merge topic 'fix-function-missing-endforeach'Brad King2015-05-191-1/+1
|\ | | | | | | | | 3a656065 Fix assertion failure on unmatched foreach in function (#15572)
| * Fix assertion failure on unmatched foreach in function (#15572)Brad King2015-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track nested loop levels in CMake language with a stack of counters, 2014-11-18) forgot to account for scopes popped by error messages about unclosed scopes. Teach the error handler to pop the lexical scope it reports as unclosed. Re-order the lexical scope RAII object to be inside the variable scope RAII object scope so that the lexical scope is fully closed before we check assertions about variable scopes. Extend the RunCMake.Syntax test with a case covering this.
* | Port cmCommand consumers to cmState.Stephen Kelly2015-04-151-3/+2
| |
* | cmFunctionCommand: Remove ineffectual code.Stephen Kelly2015-02-211-5/+0
| | | | | | | | The name variable is never used.