diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-04-08 15:56:47 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2020-04-13 15:26:03 (GMT) |
commit | f413727d27be474dc2b943b434ea12c357f65473 (patch) | |
tree | cd42253d58cac7d396af1fdc014395dc2d3f8353 /Source | |
parent | 609c3b7cdc4f633a49424de667ba332e483ffb46 (diff) | |
download | CMake-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.cxx | 6 |
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*>(>)[i]; *b++ = hexDigits[(c & 0xf0) >> 4]; *b++ = hexDigits[(c & 0x0f)]; |