[llvm] 296a684 - [formatv][FmtAlign] Use fill count of type size_t instead of uint32_t (#78459)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 18 07:16:15 PST 2024
Author: Andrei Golubev
Date: 2024-01-18T10:16:11-05:00
New Revision: 296a6842d190b8775613a2fcfd6b19847bfec5bd
URL: https://github.com/llvm/llvm-project/commit/296a6842d190b8775613a2fcfd6b19847bfec5bd
DIFF: https://github.com/llvm/llvm-project/commit/296a6842d190b8775613a2fcfd6b19847bfec5bd.diff
LOG: [formatv][FmtAlign] Use fill count of type size_t instead of uint32_t (#78459)
FmtAlign::fill() accepts a uint32_t variable while the usages operate on
size_t values. On some platform / compiler combinations, this ends up
being a narrowing conversion. Fix this by changing the function's signature.
This was first seen on MSVC x86.
Co-authored-by: Orest Chura <orest.chura at intel.com>
Added:
Modified:
llvm/include/llvm/Support/FormatCommon.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/FormatCommon.h b/llvm/include/llvm/Support/FormatCommon.h
index 3c119d12529aee..24a40c325e1314 100644
--- a/llvm/include/llvm/Support/FormatCommon.h
+++ b/llvm/include/llvm/Support/FormatCommon.h
@@ -66,8 +66,8 @@ struct FmtAlign {
}
private:
- void fill(llvm::raw_ostream &S, uint32_t Count) {
- for (uint32_t I = 0; I < Count; ++I)
+ void fill(llvm::raw_ostream &S, size_t Count) {
+ for (size_t I = 0; I < Count; ++I)
S << Fill;
}
};
More information about the llvm-commits
mailing list