This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via f259e8759ce300cd505e30cda1b5fca3ba100cc5 (commit) via 3f685ac3e131cbf89391b9e63163283e1e570a9b (commit) from f3b4a12c610e6c4fc37ea03c902c354228208726 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f259e8759ce300cd505e30cda1b5fca3ba100cc5 commit f259e8759ce300cd505e30cda1b5fca3ba100cc5 Merge: f3b4a12 3f685ac Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 25 14:23:10 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Feb 25 09:23:17 2019 -0500 Merge topic 'gt-shorter-unique-names' 3f685ac3e1 Use shorter names in internal TARGET_PROPERTY expressions Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3009 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f685ac3e131cbf89391b9e63163283e1e570a9b commit 3f685ac3e131cbf89391b9e63163283e1e570a9b Author: Brad King <brad.k...@kitware.com> AuthorDate: Fri Feb 22 08:47:45 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Feb 22 09:14:27 2019 -0500 Use shorter names in internal TARGET_PROPERTY expressions The change in commit 2f708f5d65 (Make internal TARGET_PROPERTY generator expressions more robust, 2018-09-07, v3.13.0-rc1~94^2~4) introduced globally unique names in synthesized `$<TARGET_PROPERTY:...>` generator. We used the pattern `<target-name>::T<pointer-to-generator-target>` to guarantee uniqueness. However, in projects that require many such expressions to be generated there was a measurable increase in runtime. We had included the target name in the synthesized genex only for human reference during debugging. It is not necessary. Switch to the pattern `:<pointer-to-generator-target>` to shorten the name. Also hand-roll a hex-print loop instead of using sprintf. Together these optimizations get at least some of the time back. Issue: #18964 diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fa0ffcc..baf69f4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2118,17 +2118,24 @@ void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt) } } +static char const hexDigits[] = "0123456789abcdef"; + std::string cmGlobalGenerator::IndexGeneratorTargetUniquely( cmGeneratorTarget const* gt) { // Use the pointer value to uniquely identify the target instance. - // Use a "T" prefix to indicate that this identifier is for a target. + // Use a ":" prefix to avoid conflict with project-defined targets. // We must satisfy cmGeneratorExpression::IsValidTargetName so use no // other special characters. - char buf[64]; - sprintf(buf, "::T%p", - static_cast<void const*>(gt)); // cast avoids format warning - std::string id = gt->GetName() + buf; + char buf[1 + sizeof(gt) * 2]; + char* b = buf; + *b++ = ':'; + for (size_t i = 0; i < sizeof(gt); ++i) { + unsigned char const c = reinterpret_cast<unsigned char const*>(>)[i]; + *b++ = hexDigits[(c & 0xf0) >> 4]; + *b++ = hexDigits[(c & 0x0f)]; + } + std::string id(buf, sizeof(buf)); // We internally index pointers to non-const generator targets // but our callers only have pointers to const generator targets. // They will give up non-const privileges when looking up anyway. ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits