summaryrefslogtreecommitdiffstats
path: root/Source/cmMacroCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise implementation of case-insensitive command namesFlorian Jacomme2018-05-221-3/+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.
* cmMacroCommand: Fix format string to match type of argumentjrp20142018-04-051-1/+1
|
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-1/+2
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* 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-11/+9
| | | | | | 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-4/+1
|
* Merge topic 'dead-code-removal'Brad King2017-05-111-3/+3
|\ | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | 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 cmBootstrapCommands2Daniel 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-2/+2
| | | | | | | | | | | | | | 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-2/+2
| | | | 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-82/+54
| | | | | | | | | | | | | 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.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Remove temporary allocations in cmMacroHelper::InvokeInitialPass.Milian Wolff2016-01-201-9/+7
| | | | | | | | This code used to convert std::string's to raw C strings only to put that back into a std::string. This patch thus removes ~70k temporary allocations when running the CMake daemon on KDevelop. This hotspot was found with heaptrack.
* cmAlgorithms: Rename cmRange to cmMakeRange.Stephen Kelly2015-07-221-1/+1
|
* cmMakefile: Remove special handling of MACROS property.Stephen Kelly2015-07-191-1/+1
|
* cmListFile: Remove FilePath member from cmListFileContext.Stephen Kelly2015-07-061-1/+0
| | | | | There is no need to store the FilePath for every function, as it is known by other means.
* 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-5/+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.
* cmMacroCommand: Store the FilePath when creating the prototype.Stephen Kelly2015-06-211-4/+1
| | | | Instead of setting it each time the macro is invoked.
* cmMakefile: Create a unified raii for macro scopes.Stephen Kelly2015-06-041-8/+3
|
* Port cmCommand consumers to cmState.Stephen Kelly2015-04-151-3/+2
|
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* cmMakefile: Store macro list in a vector not in a map.Stephen Kelly2015-02-211-9/+1
| | | | | The signature was computed (incorrectly) and stored as the map value, but never used. Remove it now.
* cmMacroCommand: Manipulate target string directly.Stephen Kelly2015-02-111-14/+10
| | | | | Avoid copying a string from the source, manipulating it, and then copying it back. Manipulate it in place instead.
* cmMacroCommand: Move computation of ARGV%n names out of double loop.Stephen Kelly2015-02-111-4/+9
|
* cmMacroCommand: Move ARGV replacement out of condition.Stephen Kelly2015-02-111-2/+1
|
* cmMacroCommand: Remove condition around ARGN replacement.Stephen Kelly2015-02-111-5/+1
| | | | | There is none for ARGC replacement, so no reason to conditionalize the replacement. The computation is already done.
* cmMacroCommand: Declare tmps in the scope that it's used.Stephen Kelly2015-02-111-3/+1
| | | | | We don't particularly need to reuse the string memory here, and this pattern is not common in CMake.
* cmMacroCommand: Declare arg in the scope that it is used.Stephen Kelly2015-02-111-1/+2
| | | | | | It can make sense to declare objects outside of loops if the size required by the object can grow (eg std::string when using getline), but that is not the case here.
* cmMacroCommand: Inline variable computation.Stephen Kelly2015-02-111-5/+1
|
* cmMacroCommand: Compute variables outside of two loops.Stephen Kelly2015-02-111-6/+12
| | | | | Avoid computing them from scratch for each argument of each function.
* cmMacroCommand: Remove intermediate arg variables.Stephen Kelly2015-02-111-7/+2
|
* cmMacroCommand: Remove condition around ARGN computation.Stephen Kelly2015-02-111-4/+1
| | | | | An empty string is appended if the condition is false, which is ok for this commit.
* cmMacroCommand: Remove conditional append of semicolon.Stephen Kelly2015-02-111-8/+0
| | | | The conditions are never true.
* cmMacroCommand: Declare arg variables where used and initialized.Stephen Kelly2015-02-111-21/+9
| | | | | Make the initialization by population with the expanded* content unconditional.
* cmMacroCommand: Join the args strings outside of the loops.Stephen Kelly2015-02-111-4/+6
| | | | | This means that we compute the strings even if not used in the macro but this shouldn't be expensive and it simplifies the code.
* Convert loops to cmJoin algorithm with cmRange.Stephen Kelly2015-02-111-6/+1
|
* Replace common loop pattern with cmJoinStephen Kelly2015-02-111-8/+1
|