summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-2/+2
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-1/+1
| | | | | | | | | | | | | | 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-deprecated-headersRegina Pfeifer2019-09-161-1/+1
|
* cmDefinitions: Reduce allocation of keys and values in MakeClosureBrad King2019-08-201-9/+9
| | | | | | | Use `cm::String` to store keys and values so that `MakeClosure` does not need to allocate new copies of all of them. Issue: #19581
* cmDefinitions: Cleanups and optimizationsSebastian Holtermann2019-08-081-29/+32
| | | | | | | In cmDefinitions: - sort methods in source code by static or not static - use `std::unordered_set<cm::string_view>` instead of `std::set<std::string>` for duplications tests.
* cmDefinitions: Add Unset and cm::string_view based Set methodsSebastian Holtermann2019-07-241-2/+7
| | | | | | | | | | | | | | | | | | - The `cmDefinitions::Def` struct is simplified by removing an unused constructor and the `std_string` type definition. The std::string value becomes a member variable instead of being derived from. - The `cmDefinitions::Unset` method is added that unsets a definition. It has the same functionality as calling `cmDefinitions::Set` with a `nullptr` value argument, - The `cmDefinitions::Set` method gets an overloaded version that takes a `cm::string_view` as value argument. - The originl `cmDefinitions::Set` method with `const char*` argument is refactored to either call the `cm::string_view` based `cmDefinitions::Set` overload or `cmDefinitions::Unset`, depending on whether the value `const char*` is a nullptr (`Unset`) or not (`Set`).
* cmDefinitions: CleanupsSebastian Holtermann2019-07-241-8/+9
|
* cmDefinitions: Avoid string copy when setting a definitionSebastian Holtermann2019-06-131-2/+1
|
* cmStateSnapshot::GetDefinition(): Return std::string const*Vitaly Stakhovsky2018-09-061-3/+3
| | | | Expose std::string type used internally in cmDefinitions instead of const char*
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-15/+12
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-1/+0
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-1/+1
|
* 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-0/+1
|
* 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.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-0/+2
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-1/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-55/+39
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* cmDefinitions: Implement in terms of cmLinkedTree.Stephen Kelly2015-08-231-7/+7
| | | | | | | Store the definitions in a cmLinkedTree in the cmMakefile. This can be moved to cmState and then the tree will provide snapshotting possibilities. It will also make the Closure copy created at the start of each cmMakefile unnecesarry.
* cmMakefile: Remove VarUsageStack.Stephen Kelly2015-05-191-3/+4
| | | | | | Store usage information in the cmDefintions value instead. We already pay for the memory as padding in the Def struct, so we might as well use it.
* cmMakefile: Remove VarInitStack.Stephen Kelly2015-05-191-0/+14
| | | | | | | | | | | | | | | In cmMakefile::PushScope, a copy of the closure of keys initialized in the parent scope is made. In PopScope, essentially the same copy is inserted back into the parent. That means a lot of duplication of strings and a lot of string comparisons. None of it is needed, because the cmDefinitions keys already provide a canonical representation of what is initialized. The removal of the separate container also makes the variable handling code more easy to reason about in general. Before this patch, configuring llvm uses 200 KiB for the VarInitStack. Overall peak memory consumption goes from 35.5 MiB to 35.1 MiB.
* cmMakefile: Mark definitions explicitly erased, even at top level.Stephen Kelly2015-05-191-5/+0
| | | | | | | | | | Presumably the intention here is to attempt to optimize memory by not storing what is not needed. However, all keys need to be tracked anyway to implement initialization tracking, and this special case gets in the way of simplifying the implementation of that. This doesn't change any observable effects because values set to 0 are considered not to exist by the cmDefinitions API.
* cmMakefile: Raise variable in scope explicitly when needed.Stephen Kelly2015-05-191-3/+13
| | | | | The Get method implicitly pulls a copy of all variables into a local scope. This is not necessary.
* cmDefinitions: Make the ClosureKeys method static.Stephen Kelly2015-05-171-7/+13
| | | | For consistency with all other closure-related methods.
* cmDefinitions: Centralize knowledge of iterator type.Stephen Kelly2015-05-171-19/+14
| | | | Currently we process a list of definitions, but that will change.
* cmDefinitions: Remove internal MakeClosure method.Stephen Kelly2015-05-171-13/+4
| | | | | There is no need to have a separate method, or to pass an external set to it.
* cmDefinitions: Make GetInternal method static.Stephen Kelly2015-05-011-9/+9
| | | | | | | | For some reason, using recursion here is faster to configure ParaView than using a loop. Probably some compiler optimization is inhibited by using a loop. Co-Author: Brad King <brad.king@kitware.com>
* cmDefinitions: Use static member without this->.Stephen Kelly2015-05-011-1/+1
|
* cmDefinitions: Remove Parent pointer.Stephen Kelly2015-05-011-6/+0
| | | | All structural knowledge of the stack of scopes is now external.
* cmDefinitions: Accept varStack iterators in Get API.Stephen Kelly2015-05-011-7/+14
|
* cmDefinitions: Invert conditional code.Stephen Kelly2015-04-291-5/+6
| | | | Return the simple case first.
* cmDefinitions: Externalize looping for ClosureKeys.Stephen Kelly2015-04-291-15/+8
|
* cmDefinitions: Implement MakeClosure in terms of reverse iterators.Stephen Kelly2015-04-291-9/+9
| | | | Iterate directly over the parent content provided by cmMakefile.
* cmDefinitions: Convert MakeClosure into a static method.Stephen Kelly2015-04-291-9/+4
| | | | Accept a range of cmDefinitions*.
* cmDefinitions: Implement MakeClosure in terms of a list of ancestors.Stephen Kelly2015-04-291-12/+13
|
* cmDefinitions: Use list of cmDefinitions* to create closure.Stephen Kelly2015-04-291-3/+11
|
* cmDefinitions: Replace recursion with loop.Stephen Kelly2015-04-291-18/+16
|
* cmDefinitions: Replace private constructor with MakeClosure.Stephen Kelly2015-04-291-11/+6
|
* cmDefinitions: Make ClosureKeys API vector-based.Stephen Kelly2015-04-291-7/+5
| | | | | | | Construct the final list directly in a named return value. Use a single set to track bindings already found. Co-Author: Brad King <brad.king@kitware.com>
* cmDefinitions: Inline GetClosureKeys implementation.Stephen Kelly2015-04-291-7/+1
|
* cmDefinitions: Replace ClosureKeys recursion with looping.Stephen Kelly2015-04-291-14/+14
|
* cmDefinitions: Change LocalKeys to return a vector.Stephen Kelly2015-04-291-3/+4
| | | | This is more efficient and we lose nothing.
* cmDefinitions: Externalize the Set logic.Stephen Kelly2015-04-291-10/+1
|
* cmDefinitions: Add an Erase method.Stephen Kelly2015-04-291-0/+5
|
* cmDefinitions: Inline SetInternal method.Stephen Kelly2015-04-281-15/+9
|
* cmDefinitions: Remove unused Set return value.Stephen Kelly2015-04-281-5/+3
|
* cmDefinitions: Remove unused method.Stephen Kelly2015-04-281-7/+0
|
* Merge topic 'revert-definition-map-lookup'Brad King2014-10-271-17/+5
|\ | | | | | | | | | | | | | | d1b62185 Merge branch 'parent-scope-tests' into variable-pull-failure 5f414cef Revert "cmDefinitions: Don't store parent lookups" e0c0b1ac test: add a test for PARENT_SCOPE with multiple scopes 064c415d test: add test for PARENT_SCOPE behavior
| * Revert "cmDefinitions: Don't store parent lookups"Ben Boeckel2014-10-241-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49. The behaviors associated with implicit pulldown on variable lookup seriously conflict with the optimizations made in these commits. Basically, since values were copied upon variable lookup, not just on PARENT_SCOPE, coupled with PARENT_SCOPE's behavior based on whether the variable is in the current scope or not causes serious problems with not storing a value for every variable at every scope. The commit changed behavior of the following example, among other cases: function(test_set) set(blah "value2") message("before PARENT_SCOPE blah=${blah}") set(blah ${blah} PARENT_SCOPE) message("after PARENT_SCOPE blah=${blah}") endfunction() set(blah value1) test_set() message("in parent scope, blah=${blah}") Reported-by: Alex Merry <alex.merry@kde.org> Reported-by: Ben Cooksley <bcooksley@kde.org>