Auto merge of #38223 - rkruppe:llvm-stringref-fixes, r=alexcrichton
printf type correctness The `%.*s` format specifier requires an int for the maximum size, but StringRef::size is a size_t cc @shepmaster
This commit is contained in:
commit
ebf2e7da5b
|
@ -533,8 +533,11 @@ LLVMRustPrintPasses() {
|
||||||
StringRef PassArg = info->getPassArgument();
|
StringRef PassArg = info->getPassArgument();
|
||||||
StringRef PassName = info->getPassName();
|
StringRef PassName = info->getPassName();
|
||||||
if (!PassArg.empty()) {
|
if (!PassArg.empty()) {
|
||||||
printf("%15.*s - %.*s\n", PassArg.size(), PassArg.data(),
|
// These unsigned->signed casts could theoretically overflow, but
|
||||||
PassName.size(), PassName.data());
|
// realistically never will (and even if, the result is implementation
|
||||||
|
// defined rather plain UB).
|
||||||
|
printf("%15.*s - %.*s\n", (int)PassArg.size(), PassArg.data(),
|
||||||
|
(int)PassName.size(), PassName.data());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (info->getPassArgument() && *info->getPassArgument()) {
|
if (info->getPassArgument() && *info->getPassArgument()) {
|
||||||
|
|
Loading…
Reference in New Issue