summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionDAGChecker.cxx
Commit message (Collapse)AuthorAgeFilesLines
* silence selected clang-tidy violationsDaniel Pfeifer2016-10-181-2/+3
|
* Simplify CMake per-source license noticesBrad King2016-09-271-12/+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/+8
|
* Make sure unnused parameters are /*named*/Daniel Pfeifer2016-08-161-1/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-114/+99
| | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove some obsolete declarationsStephen Kelly2015-10-271-1/+0
| | | | | | | | | | | | | Ensure that cmStandardIncludes.h is included before any platform header in cmGeneratorExpressionEvaluator.h. That file needs to change as a result of removal of the cmMakefile.h header from cmGeneratorExpressionNode.h, affecting the compilation of cmGeneratorExpressionNode.cxx. On AIX we need to include our own headers first to get large file support macros defined consistently within system headers. The old order in this header worked only because it was always included after other headers.
* cmGeneratorExpression: Port to cmLocalGenerator.Stephen Kelly2015-10-121-3/+4
|
* cmMakefile: Make cmListFileBacktrace default constructible.Stephen Kelly2015-06-021-1/+1
|
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* Merge topic 'drop-ancient-workarounds'Brad King2015-01-121-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0f7bdd61 Remove VS 6 special case. 5e92c826 Remove some obsolete stuff. 15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream. 931e055d Port all cmOStringStream to std::ostringstream. f194a009 Remove unused cmIStringStream class. 3ec1bb15 cmStandardIncludes: Remove std namespace hack. bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack. 28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler. 837a8a63 cmStandardIncludes: Drop Comeau-related workaround. 4030ddfd Remove Borland-related undef. 17d6a6fd cmStandardIncludes: Remove comment about Borland. 26fb5011 Drop SGI as a CMake host compiler.
| * Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-3/+3
| | | | | | | | All compilers hosting CMake support the std class.
* | Help: Remove documented restriction on find in conditions.Stephen Kelly2015-01-111-3/+1
|/ | | | The necessary conversion is supported by all CMake host compilers.
* backtrace: Convert to local paths in IssueMessageBen Boeckel2014-06-051-1/+1
| | | | | This is the only place we care show the FilePath to the user, so defer the expensive relative path calculation until here.
* genex: remove the need for backtracesBen Boeckel2014-06-051-3/+23
| | | | | Rather than making dummy backtraces and passing them around, just make backtraces optional.
* cmTarget: Allow transitive evaluation of SOURCES property.Stephen Kelly2014-04-021-0/+12
| | | | | | | Extend the cmGeneratorExpressionDAGChecker with an interface returning the name of the top target. Use that to determine when there is a DAG violation, as required by the RunCMake.Languages tests.
* Remove some c_str() calls.Stephen Kelly2014-03-111-3/+3
| | | | | | 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.
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-3/+3
| | | | | | | | | | | 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.
* Genex: Fix case of methods in the dag checker.Stephen Kelly2014-01-061-4/+4
|
* Genex: Use a preprocessor loop to implement transitive DAG check.Stephen Kelly2014-01-061-32/+25
| | | | | | | | | The other infrastructure for transitive property handling is already using a preprocessor loop. Implement special backward-compatibility handling of COMPILE_DEFINITIONS_<CONFIG> using a template switch for the extra check.
* cmTarget: Fix system include annotation propagation.Stephen Kelly2014-01-061-1/+2
| | | | | | | | | | | | Direct users of IMPORTED targets treat INTERFACE_INCLUDE_DIRECTORIES as SYSTEM, after commit a63fcbcb (Always consider includes from IMPORTED targets to be SYSTEM., 2013-08-29). It was intended that transitive use of an IMPORTED target would have the same behavior, but that did not work. The implementation processed only direct dependencies in cmTarget::FinalizeSystemIncludeDirectories. Implement transitive evaluation of dependencies by traversing the link interface of each target in the link implementation.
* Undefine local preprocessor loop variables.Stephen Kelly2014-01-061-0/+1
| | | | | Most occurances of this pattern already contain the undef, so add it to the rest too.
* QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.Stephen Kelly2013-11-271-0/+8
| | | | | | | | | | | | | | | | | | | | Transitively consume the property from linked dependents. Implement configuration-specific support by following the pattern set out for compile definitions and includes in cmQtAutoGenerators. Implement support for origin-tracking with CMAKE_DEBUG_TARGET_PROPERTIES. This is motivated by the needs of KDE, which provides a separate translation system based on gettext instead of the Qt linguist translation system. The Qt uic tool provides command line options for configuring the method used to translate text, and to add an include directive to the generated file to provide the method. http://thread.gmane.org/gmane.comp.kde.devel.frameworks/7930/focus=7992 Implement the interface to provide the uic options as a usage-requirement on the KI18n target, as designed for KDE.
* Use new cmHasLiteralPrefix functionStephen Kelly2013-11-211-3/+3
|
* Merge topic 'tid-system-argument'Brad King2013-07-161-0/+8
|\ | | | | | | | | | | | | | | | | | | 9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property. 1925cff Add a SYSTEM parameter to target_include_directories (#14180) 286f227 Extend the cmTargetPropCommandBase interface property handling. 83498d4 Store system include directories in the cmTarget. f1fcbe3 Add Target API to determine if an include is a system include. 2679a34 Remove unused variable.
| * Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.Stephen Kelly2013-07-161-0/+8
| | | | | | | | | | | | | | | | Unlike other target properties, this does not have a corresponding non-INTERFACE variant. This allows propagation of system attribute on include directories from link dependents.
* | Introduce the INTERFACE_LINK_LIBRARIES property.Stephen Kelly2013-07-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This property replaces the properties which match (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?, and is enabled for IMPORTED targets, and for non-IMPORTED targets only with a policy. For static libraries, the INTERFACE_LINK_LIBRARIES property is also used as the source of transitive usage requirements content. Static libraries still require users to link to all entries in their LINK_LIBRARIES, but usage requirements such as INCLUDE_DIRECTORIES COMPILE_DEFINITIONS and COMPILE_OPTIONS can be restricted to only certain interface libraries. Because the INTERFACE_LINK_LIBRARIES property is populated unconditionally, we need to compare the evaluated result of it with the link implementation to determine whether to issue the policy warning for static libraries. For shared libraries, the policy warning is issued if the contents of the INTERFACE_LINK_LIBRARIES property differs from the contents of the relevant config-specific old LINK_INTERFACE_LIBRARIES property.
* | Introduce the LINK_ONLY generator expression.Stephen Kelly2013-07-071-1/+15
|/ | | | | This is an internal expression for use by target_link_libraries for static libraries.
* Genex: Extend EvaluatingLinkLibraries to also check the top target name.Stephen Kelly2013-06-241-1/+7
| | | | | This will allow testing whether we are evaluating the link libraries of a particular target.
* Use a preprocessor loop to manage the valid transitive properties.Stephen Kelly2013-06-101-3/+7
| | | | | Hopefully this will prevent regressions when adding further transitive properties in the future.
* Add missing 'seen' check for evaluating COMPILE_OPTIONS.Stephen Kelly2013-06-101-1/+2
| | | | | | | | | | | | | | | Commit 089fe1c1 (Optimize genex evaluation for includes and defines., 2013-02-01) introduced an optimization on DAG processing to not reprocess properties on targets which have already been seen. This was refactored slightly in commit 8dfdf1c7 (Fix the tests for evaluating includes and defines., 2013-02-18), but was not extended to cover COMPILE_OPTIONS in commit 80ca9c4b (Add COMPILE_OPTIONS target property., 2013-05-16). This omission causes the same performance regression in running cmake on LLVM which 089fe1c1 fixed before, but this time for the transitive evaluation of the COMPILE_OPTIONS property.
* Add COMPILE_OPTIONS target property.Stephen Kelly2013-06-021-0/+8
| | | | | | This method reads generator expressions from the COMPILE_OPTIONS target property, as well as INTERFACE_COMPILE_OPTIONS from linked dependents.
* Fix the tests for evaluating includes and defines.Stephen Kelly2013-02-231-2/+2
| | | | | | | | | | | | We should also check whether the INTERFACE_ variant of a property is being read, and in the case of the compile definitions, we should test the _<CONFIG> suffixed variants. That is already available through the use of the methods. This way, we use the ALREADY_SEEN optimization when evaluating the includes of a target in 'external' generator expressions, ie, those used in a add_custom_command invokation, as opposed to evaluating the INCLUDE_DIRECTORIES of a target itself via GetIncludeDirectories.
* Fix constness of accessors.Stephen Kelly2013-02-231-2/+2
|
* Fix DAG checker finding cycling dependencies.Stephen Kelly2013-02-231-1/+1
| | | | | | | | | | | | | | | | Before this patch, the following is reported falsely as a self-reference: target_link_libraries(empty2 LINK_PUBLIC empty3) target_link_libraries(empty3 LINK_PUBLIC empty2) add_custom_target(... -DINCLUDES=$<TARGET_PROPERTY:empty2,INTERFACE_INCLUDE_DIRECTORIES> ) The reason is that the existing code assumed that all reading of include directories would be done through cmTarget::GetIncludeDirectories() and would therefore be initialized with a DagChecker. That is not the case if reading the property with an 'external' generator expression.
* Fix determination of when we're evaluating compile definitions.Stephen Kelly2013-02-121-1/+2
| | | | Also handle the config-specific property.
* Fix determination of evaluating link libraries.Stephen Kelly2013-02-071-2/+2
| | | | | Added in commit 6fbe3ce4 (Exclude the LINK_LIBRARIES related properties from INTERFACE evaluation., 2013-01-23)
* Optimize genex evaluation for includes and defines.Stephen Kelly2013-02-021-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | While porting boost to use these features, the generation step took too long (several minutes before I stopped it). The reason was that the boost libraries form a large interdependent mesh. The libraries list their dependencies in their INTERFACE such as: $<LINKED:boost::core>;$<LINKED:boost::config>;$<LINKED:boost::mpl> As boost::core already depends on the boost::config libraries, that expression has no impact on the end-content, as it is removed after the generation step. There is no DAG issue though, so the generator expression evaluation would fully evaluate them. In the case of the config library, it also depends on the core library, so all depends are followed through that again, despite the fact that they've just been evaluated. After this patch, the evaluation skips libraries if they have already been seen via depends or directly in the content. This patch keeps track of targets whose INTERFACE has been consumed already. The INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS properties are whitelisted because repeated content will be stripped out later during generation. For other properties now and in the future, that may not be the case.
* Add API to check if we're reading a includes or defines property.Stephen Kelly2013-01-311-0/+16
| | | | This will allow the implementation of the LINKED generator expression.
* Exclude the LINK_LIBRARIES related properties from INTERFACE evaluation.Stephen Kelly2013-01-241-2/+8
| | | | | | These interface-related link-libraries properties are used to determine the value of the other INTERFACE properties, so we were getting infinite recursion and segfaults otherwise.
* Make INTERFACE determined properties readable in generator expressions.Stephen Kelly2013-01-201-0/+13
| | | | | The properties are evaluated as link-dependent interface properties when evaluating the generator expressions.
* Make cycles in target properties ignored, not an error.Stephen Kelly2013-01-051-7/+9
| | | | | | | | | | | | | | | | Constructs such as these are an error as they are direct self-references: set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>) set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:INCLUDE_DIRECTORIES>) However, this is an indirect self-reference in a cycle, and not an error: set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:bar,INCLUDE_DIRECTORIES>) set_property(TARGET bar APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>)
* Make all relevant targets available in the genex context.Stephen Kelly2013-01-051-1/+1
| | | | | The current node being evaluated transitively in the generator expression must be available to resolve mapped configs.
* Add API to check that dependent target properties form a DAG.Stephen Kelly2012-09-281-0/+106
Initially this will only be used to check for self-references, but can be extended to check for cycles when chaining properties of other targets.