summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.h
Commit message (Collapse)AuthorAgeFilesLines
* Use C++11 unordered containersDaniel Pfeifer2017-08-221-2/+2
|
* cmDefinitions::Def: remove custom copy ctorDaniel Pfeifer2017-04-211-6/+0
|
* 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-4/+4
|
* Introduce CM_UNORDERED_MAPDaniel Pfeifer2016-10-241-19/+2
| | | | | Avoid duplicating switch among std::unordered_map, cmsys::hash_map, and std::map.
* 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-4/+5
|
* make sure to include cmConfigure.h before cmStandardIncludes.hDaniel Pfeifer2016-09-031-0/+2
|
* Make C++ feature checks extensibleDaniel Pfeifer2016-06-271-2/+2
| | | | | | Turn the feature check for cxx11_unordered_map into a function such that we can use it for other features as well. Drop the 11 suffix, as we may want to check features from other standards.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-18/+33
| | | | | | | | | | | | | 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.
* cmDefinitions: Implement in terms of cmLinkedTree.Stephen Kelly2015-08-231-7/+10
| | | | | | | 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-6/+10
| | | | | | 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/+3
| | | | | | | | | | | | | | | 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-2/+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/+3
| | | | | The Get method implicitly pulls a copy of all variables into a local scope. This is not necessary.
* Merge topic 'use-std-unordered_map'Brad King2015-05-191-1/+8
|\ | | | | | | | | | | | | d7923b82 Use std::unordered_map instead of hash_map where available. 820777af Tests: Don't rely on ordering of targets in maps. 921d74d8 AutoGen: Don't iterate over a container while populating it.
| * Use std::unordered_map instead of hash_map where available.Stephen Kelly2015-05-181-1/+8
| |
* | cmDefinitions: Make the ClosureKeys method static.Stephen Kelly2015-05-171-2/+2
| | | | | | | | For consistency with all other closure-related methods.
* | cmDefinitions: Centralize knowledge of iterator type.Stephen Kelly2015-05-171-7/+5
| | | | | | | | Currently we process a list of definitions, but that will change.
* | cmDefinitions: Remove internal MakeClosure method.Stephen Kelly2015-05-171-3/+0
|/ | | | | There is no need to have a separate method, or to pass an external set to it.
* cmDefinitions: Make Get method static.Stephen Kelly2015-05-011-3/+3
|
* cmDefinitions: Make GetInternal method static.Stephen Kelly2015-05-011-5/+3
| | | | | | | | 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: Remove Parent pointer.Stephen Kelly2015-05-011-9/+0
| | | | All structural knowledge of the stack of scopes is now external.
* cmDefinitions: Accept varStack iterators in Get API.Stephen Kelly2015-05-011-2/+6
|
* cmDefinitions: Externalize looping for ClosureKeys.Stephen Kelly2015-04-291-2/+2
|
* cmDefinitions: Implement MakeClosure in terms of reverse iterators.Stephen Kelly2015-04-291-4/+4
| | | | Iterate directly over the parent content provided by cmMakefile.
* cmDefinitions: Convert MakeClosure into a static method.Stephen Kelly2015-04-291-1/+3
| | | | Accept a range of cmDefinitions*.
* cmDefinitions: Implement MakeClosure in terms of a list of ancestors.Stephen Kelly2015-04-291-1/+4
|
* cmDefinitions: Replace private constructor with MakeClosure.Stephen Kelly2015-04-291-8/+3
|
* cmDefinitions: Make ClosureKeys API vector-based.Stephen Kelly2015-04-291-1/+1
| | | | | | | 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-4/+0
|
* cmDefinitions: Change LocalKeys to return a vector.Stephen Kelly2015-04-291-1/+1
| | | | This is more efficient and we lose nothing.
* cmDefinitions: Add an Erase method.Stephen Kelly2015-04-291-0/+2
|
* cmDefinitions: Inline SetInternal method.Stephen Kelly2015-04-281-1/+0
|
* cmDefinitions: Remove unused Set return value.Stephen Kelly2015-04-281-1/+1
|
* cmDefinitions: Remove unused method.Stephen Kelly2015-04-281-3/+0
|
* Merge topic 'revert-definition-map-lookup'Brad King2014-10-271-6/+4
|\ | | | | | | | | | | | | | | 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-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | cmDefinitions: Use a hashmap for faster checksBen Boeckel2014-06-091-0/+7
|/ | | | | The hash map is much faster at checking that the map won't have what we're looking for so that we can just go to the parent scope instead.
* cmDefinitions: Don't store parent lookupsBen Boeckel2014-06-091-4/+6
| | | | | When looking up scopes, it is faster to not store the lookup locally to keep the maps smaller and avoid extra allocations and rebalancing.
* stringapi: Add string overload for the Def structBen Boeckel2014-03-081-0/+1
|
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-10/+13
| | | | | | | | | | | Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited.
* stringapi: Use strings for variable namesBen Boeckel2014-03-081-4/+4
| | | | Variable names are always generated by CMake and should never be NULL.
* Add method to get the local scope variablesBen Boeckel2010-09-011-0/+3
|
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.
* ENH: Improve dynamic variable scope implementationBrad King2009-07-221-0/+88
Previously each new variable scope (subdirectory or function call) in the CMake language created a complete copy of the key->value definition map. This avoids the copy using transitive lookups up the scope stack. Results of queries answered by parents are stored locally to maintain locality of reference. The class cmDefinitions replaces cmMakefile::DefinitionsMap, and is aware of its enclosing scope. Each scope stores only the definitions set (or unset!) inside it relative to the enclosing scope.