[llvm] [formatv][FmtAlign] Use fill count of type size_t instead of uint32_t (PR #78459)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 08:07:52 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: Andrei Golubev (andrey-golubev)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/78459.diff
1 Files Affected:
- (modified) llvm/include/llvm/Support/FormatCommon.h (+2-2)
``````````diff
diff --git a/llvm/include/llvm/Support/FormatCommon.h b/llvm/include/llvm/Support/FormatCommon.h
index 3c119d12529aeed..24a40c325e13148 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;
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/78459
More information about the llvm-commits
mailing list