summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-04-08 15:56:47 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2020-04-13 15:26:03 (GMT)
commitf413727d27be474dc2b943b434ea12c357f65473 (patch)
treecd42253d58cac7d396af1fdc014395dc2d3f8353 /Source
parent609c3b7cdc4f633a49424de667ba332e483ffb46 (diff)
downloadCMake-f413727d27be474dc2b943b434ea12c357f65473.zip
CMake-f413727d27be474dc2b943b434ea12c357f65473.tar.gz
CMake-f413727d27be474dc2b943b434ea12c357f65473.tar.bz2
clang-tidy: address bugprone-sizeof-expression lint
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ccbbf53..4a6f6fb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2253,10 +2253,12 @@ std::string cmGlobalGenerator::IndexGeneratorTargetUniquely(
// Use a ":" prefix to avoid conflict with project-defined targets.
// We must satisfy cmGeneratorExpression::IsValidTargetName so use no
// other special characters.
- char buf[1 + sizeof(gt) * 2];
+ constexpr size_t sizeof_ptr =
+ sizeof(gt); // NOLINT(bugprone-sizeof-expression)
+ char buf[1 + sizeof_ptr * 2];
char* b = buf;
*b++ = ':';
- for (size_t i = 0; i < sizeof(gt); ++i) {
+ for (size_t i = 0; i < sizeof_ptr; ++i) {
unsigned char const c = reinterpret_cast<unsigned char const*>(&gt)[i];
*b++ = hexDigits[(c & 0xf0) >> 4];
*b++ = hexDigits[(c & 0x0f)];