summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.h
Commit message (Collapse)AuthorAgeFilesLines
* cmListFileCache: Make cmListFileFunction a shared pointerOleksandr Koval2020-10-011-7/+50
| | | | | Passing cmListFileFunction everywhere by-value involves big overhead. Now cmListFileFunction stores std::shared_ptr to the underlying data.
* cmake_language: Add signature to DEFER calls to later timesBrad King2020-09-291-2/+8
| | | | Fixes: #19575
* cmListFileCache: Add explicit constructorsBrad King2020-09-281-0/+8
| | | | | In order to construct with an initializer list in pure C++11, add the explicit constructors.
* 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.
* Add BTs helper to support multiple backtracesJustin Goshi2020-07-061-0/+26
|
* cmake_command: Add command to EVAL a CMake script as a stringCristian Adam2020-03-031-0/+3
|
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-1/+1
|
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
| | | | | | | | An old workaround for `std::allocator_traits<>::value_type` lints from IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`. Convert the workaround to use the same approach we already use for a workaround of `std::__decay_and_strip<>::::__type` lints. Then update the `<memory>` inclusions to follow the now-correct IWYU lints.
* cleanup: Prefer compiler provided special member functionsRegina Pfeifer2019-01-251-10/+0
|
* clang-tidy: Use `= default`Regina Pfeifer2019-01-251-4/+4
| | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* clang-tidy: Pass by valueRegina Pfeifer2019-01-221-2/+2
|
* clang-tidy: Use default member initializationRegina Pfeifer2018-12-151-17/+7
|
* clang-tidy: Remove redundant member initializationsRegina Pfeifer2018-12-151-5/+2
|
* cmLocalGenerator::AppendDefines: Remove const char* overloadsVitaly Stakhovsky2018-10-261-1/+2
| | | | Accept const std::string& arguments only
* cmListFileCache: Add ExpandListWithBacktrace helperBrad King2018-10-171-0/+3
|
* cmListFileCache: Add wrapper template for values with a backtraceBrad King2018-10-171-0/+29
|
* clang-tidy: restore 'misc-noexcept-move-constructor'Brad King2018-09-261-2/+4
| | | | | | We disabled this in commit 1fe0d72eb6 (clang-tidy: exclude 'misc-noexcept-move-constructor', 2018-09-24) due to false positives. Restore it and use a NOLINT comment to suppress them instead.
* cmListFileCache: Add missing assertion in backtrace Top methodBrad King2018-09-261-1/+1
| | | | | We can only get the top of a stack that has at least one call. Update the method's comment accordingly.
* cmListFileCache: Refactor cmListFileBacktrace internalsBrad King2018-09-241-11/+15
| | | | | | | | Replace use of raw pointers and explicit reference counting with `std::shared_ptr<>`. Use a discriminated union to store either the bottom level or a call/file context in each heap-allocated entry. This avoids storing a copy of the bottom in every `cmListFileBacktrace` instance and shrinks the structure to a single `shared_ptr`.
* Revise implementation of case-insensitive command namesFlorian Jacomme2018-05-221-4/+15
| | | | | | | | | | | | | | | | | | | | 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.
* misc: Added utility method to allow working with stacksJustin Berger2017-11-011-0/+4
|
* Pass large types by const&, small types by valueDaniel Pfeifer2017-06-031-3/+3
|
* cmListFileArgument: 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'
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-1/+0
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Split auxiliary classes into separate filesStephen Kelly2016-10-191-0/+1
| | | | | | | Port dependents to the new locations as needed. Leave behind a cmState.h include in cmListFileCache to reduce noise. It is removed in a following commit.
* cmState: Port dependent code to new cmStateSnapshot nameStephen Kelly2016-10-191-5/+5
|
* cmListFileBacktrace: Add a method to retrieve the Bottom of a snapshotStephen Kelly2016-10-151-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.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-2/+5
|
* make sure to include cmConfigure.h before cmStandardIncludes.hDaniel Pfeifer2016-09-031-0/+2
|
* Parser: Port away from cmMakefileStephen Kelly2016-08-251-2/+3
| | | | It is an unneeded dependency.
* Parser: Out-of-line conditional code to cmMakefileStephen Kelly2016-06-131-1/+1
| | | | Simplify parser API.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-18/+36
| | | | | | | | | | | | | 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.
* cmListFileBacktrace: Refactor storage to provide efficient value semanticsBrad King2016-04-181-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit v3.4.0-rc1~321^2~2 (Genex: Store a backtrace, not a pointer to one, 2015-07-08) we treat cmListFileBacktrace instances as lightweight values. This was true at the time only because the backtrace information was kept in the cmState snapshot hierarchy. However, that forced us to accumulate a lot of otherwise short-lived snapshots just to have the backtrace fields available for reference by cmListFileBacktrace instances. Recent refactoring made backtrace instances independent of the snapshot hierarchy to avoid accumulating short-lived snapshots. This came at the cost of making backtrace values heavy again, leading to lots of string coying and slower execution. Fix this by refactoring cmListFileBacktrace to provide value semantics with efficient shared storage underneath. Teach cmMakefile to maintain its call stack using an instance of cmListFileBacktrace. This approach allows the current backtrace to be efficiently saved whenever it is needed. Also teach cmListFileBacktrace the notion of a file-level scope. This is useful for messages about the whole file (e.g. during parsing) that are not specific to any line within it. Push the CMakeLists.txt scope for each directory and never pop it. This ensures that we always have some context information and simplifies cmMakefile::IssueMessage. Push/pop a file-level scope as each included file is processed. This supersedes cmParseFileScope and improves diagnostic message context information in a few places. Fix the corresponding test cases to expect the improved output.
* cmState: Avoid accumulating snapshot storage for backtracesBrad King2016-04-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes during post-3.3/pre-3.4 development refactored storage of most configure-time information, including variable bindings and function scopes. All scopes (even short-lived) were kept persistently for possible future debugging features, causing huge accumulated memory usage. This was mostly addressed by commit v3.4.1~4^2 (cmState: Avoid accumulating snapshot storage for short-lived scopes, 2015-11-24). Since then we still keep short-lived scopes when they are needed for a backtrace. This is because since commit v3.4.0-rc1~378^2 (cmListFileBacktrace: Implement in terms of cmState::Snapshot, 2015-05-29) backtraces have been lightweight objects that simply point into the snapshot tree. While the intention of this approach was to avoid duplicating the call stack file path strings, the cost turned out to be holding on to the entire call stack worth of scope snapshots, which is much worse. Furthermore, since commit v3.4.0-rc2~1^2 (cmIfCommand: Issue CMP0054 warning with appropriate context, 2015-10-20) all conditions used in `if()` commands hold a backtrace for use in diagnostic messages. Even though the backtrace is short-lived it still causes the scope snapshot to be kept. This means that code like function(foo) if(0) endif() endfunction() foreach(i RANGE 1000000) foo() endforeach() accumulates storage for the function call scope snapshots. Fix this by partially reverting commit v3.4.0-rc1~378^2 and saving the entire call stack during cmListFileBacktrace construction. This way we can avoid keeping short-lived scope snapshot storage in all cases.
* cmListFileCache: Fix warning about inconsistent use of class/structTobias Hunger2016-02-111-1/+2
| | | | Exposed by Clang trunk.
* Merge branch 'reduce-cmState-accumulation' into ↵Brad King2015-11-251-4/+2
|\ | | | | | | reduce-cmState-accumulation-for-master
| * cmListFileCache: Implement cmListFileBacktrace ctor/dtor out-of-lineBrad King2015-11-251-4/+2
| |
* | cmTarget: Split storage of link implementation from backtraces.Stephen Kelly2015-10-081-9/+0
|/
* cmListFileBacktrace: Constify API.Stephen Kelly2015-07-181-2/+2
|
* cmListFileBacktrace: Implement in terms of cmState::Snapshot.Stephen Kelly2015-07-061-5/+5
| | | | Avoid copying many strings into each backtrace object.
* cmListFile: Remove FilePath member from cmListFileContext.Stephen Kelly2015-07-061-1/+18
| | | | | There is no need to store the FilePath for every function, as it is known by other means.
* cmListFileArgument: Remove FilePath member.Stephen Kelly2015-06-211-7/+5
| | | | It is now unused.
* cmListFileBacktrace: Replace local generator with cmState::Snapshot.Stephen Kelly2015-06-061-4/+4
| | | | Construct cmOutputConverter only when needed.
* cmListFileBacktrace: Internalize the step of making paths relative.Stephen Kelly2015-06-021-4/+0
| | | | | | Currently cmMakefile calls MakeRelative on a copy of the backtrace, emits the copy to the stream once, then discards the copy. There is no need to have API for the path conversion.
* cmMakefile: Make cmListFileBacktrace default constructible.Stephen Kelly2015-06-021-1/+1
|
* cmListFileBacktrace: Hide the context-stack implementation detail.Stephen Kelly2015-05-181-1/+6
| | | | | | The backtrace will soon not be implemented in terms of a stack of cmListFileContext objects. Keep the cmListFileContext in the API for convenience for now.
* cmListFileContext: Implement EqualityComparable.Stephen Kelly2015-05-181-0/+2
|
* cmListFileContext: Implement LessThanComparable.Stephen Kelly2015-05-181-0/+1
| | | | | Move wrapping existing code from cmMakefile, and simplify the implementation there.