summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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-4/+4
|
* Pass large types by const&, small types by valueDaniel Pfeifer2017-06-031-3/+5
|
* clang-tidy: avoid copyDaniel Pfeifer2017-04-211-2/+3
|
* 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'
* cmListFileLexer: bail out on seek-errorsGregor Jasny2017-02-271-0/+7
| | | | | | | If we are given a FIFO, for example, we cannot seek back after trying to read a Byte-Order-Mark. Closes: #16607
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Port dependent code to new cmStateSnapshot nameStephen Kelly2016-10-191-3/+3
|
* 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.
* Convert: Remove last uses of HOME enum valueStephen Kelly2016-09-191-4/+4
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-2/+5
|
* Improve error message on unexpected end of fileBrad King2016-08-301-2/+1
| | | | Suggested-by: Stephen Kelly <steveire@gmail.com>
* Convert: Replace trivial conversion with new methodStephen Kelly2016-08-271-2/+4
|
* Parser: Port away from cmMakefileStephen Kelly2016-08-251-15/+16
| | | | It is an unneeded dependency.
* Parser: Issue messages through cmake, not cmSystemToolsStephen Kelly2016-08-251-30/+40
| | | | | Make these messages uniform with regard to other messages issued by cmake.
* Parser: Store the Backtrace for use in issuing messagesStephen Kelly2016-08-241-0/+2
|
* CMake: don't use else after returnDaniel Pfeifer2016-08-181-6/+4
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-3/+3
|
* Parser: Out-of-line conditional code to cmMakefileStephen Kelly2016-06-131-71/+1
| | | | Simplify parser API.
* Parser: Issue file open error messages through dedicated APIStephen Kelly2016-06-131-6/+9
|
* Parser: Merge identical conditionsStephen Kelly2016-06-081-3/+0
|
* Simplify boolean expressionsDaniel Pfeifer2016-06-021-4/+1
| | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-237/+164
| | | | | | | | | | | | | 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-8/+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.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* 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>
* cmListFileBacktrace: Refactor storage to provide efficient value semanticsBrad King2016-04-181-36/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-29/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix spelling typos in comments and documentation (#16037)Felix Geyer2016-03-291-1/+1
| | | | | The Debian package checker tool (lintian) detected several typos in CMake.
* Merge branch 'reduce-cmState-accumulation' into ↵Brad King2015-11-251-0/+15
|\ | | | | | | reduce-cmState-accumulation-for-master
| * cmState: Avoid accumulating snapshot storage for short-lived scopesBrad King2015-11-251-0/+4
| | | | | | | | | | We need to keep only certain snapshot types and their ancestors. Also keep those needed for backtraces.
| * cmListFileCache: Implement cmListFileBacktrace ctor/dtor out-of-lineBrad King2015-11-251-0/+11
| |
* | Add cmOutputConverter include where needed.Stephen Kelly2015-10-051-1/+1
|/
* cmListFileBacktrace: Constify API.Stephen Kelly2015-07-181-2/+2
|
* cmListFileBacktrace: Implement in terms of cmState::Snapshot.Stephen Kelly2015-07-061-14/+24
| | | | Avoid copying many strings into each backtrace object.
* 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.
* cmListFileArgument: Remove FilePath member.Stephen Kelly2015-06-211-3/+2
| | | | 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-18/+8
| | | | | | 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.
* cmListFileBacktrace: Hide the context-stack implementation detail.Stephen Kelly2015-05-181-0/+30
| | | | | | 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/+10
|
* cmListFileContext: Sort by line before file.Stephen Kelly2015-05-181-4/+5
| | | | | | This should be much faster. In the context where it is used the line comparison should be sufficient, removing the need to compare files at all.
* cmListFileContext: Implement LessThanComparable.Stephen Kelly2015-05-181-0/+8
| | | | | Move wrapping existing code from cmMakefile, and simplify the implementation there.
* cmListFile: Remove unused member.Stephen Kelly2015-04-041-6/+0
| | | | | It is written, but not read since commit v2.4.0~575 (ENH: Since list file cache does not make much sense any more ..., 2006-02-07).
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-8/+8
| | | | All compilers hosting CMake support the std class.
* Remove borland workarounds.Stephen Kelly2014-10-151-3/+0
| | | | | CMake 3.0 is the last release to require to be able to build with Borland.
* cmake: Do not open directories as scripts (#14966)Brad King2014-06-091-1/+2
| | | | | Check if a file path is a directory before opening it. Extend the RunCMake.CommandLine test with a case running "cmake -P" on a directory.
* backtrace: Convert to local paths in IssueMessageBen Boeckel2014-06-051-0/+18
| | | | | This is the only place we care show the FilePath to the user, so defer the expensive relative path calculation until here.
* Remove some c_str() calls.Stephen Kelly2014-03-111-2/+2
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* Add Lua-style long brackets and long comments to CMake languageBrad King2013-10-171-31/+49
| | | | | | | | | | | | | | | | | Teach the CMake language parser to recognize Lua-style "long bracket" arguments. These start with two '[' separated by zero or more '=' characters e.g. "[[" or "[=[" or "[==[". They end with two ']' separated by the same number of '=' as the opening bracket. There is no nesting of brackets of the same level (number of '='). No escapes, variable expansion, or other processing is performed on the content between such brackets so they always represent exactly one argument. Also teach CMake to parse and ignore "long comment" syntax. A long comment starts with "#" immediately followed by an opening long bracket. It ends at the matching close long bracket. Teach the RunCMake.Syntax test to cover long bracket and long comment cases.