diff options
author | Sven Verdoolaege <sven@cerebras.net> | 2024-06-22 12:20:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 12:20:06 -0700 |
commit | ca5ba2e46445caf2c8063a53eb6351fb596190e8 (patch) | |
tree | 1e2b0f1564e1007450c7eb75d366d7b580ad5037 /llvm/lib/MC/MCCodeView.cpp | |
parent | 6621505a1eb5428b13d2d29f377050624ef5531c (diff) | |
download | llvm-ca5ba2e46445caf2c8063a53eb6351fb596190e8.zip llvm-ca5ba2e46445caf2c8063a53eb6351fb596190e8.tar.gz llvm-ca5ba2e46445caf2c8063a53eb6351fb596190e8.tar.bz2 |
[Support] Avoid warning about possibly uninitialized variable in format_provider (#95704)
The original implementation of HelperFunctions::consumeHexStyle always
sets Style when it returns true, but this is difficult for a compiler
to understand since it requires seeing that Str starts
with either an "x" or an "X" when starts_with_insensitive("x")
return true.
In particular, g++ 12 warns that HS may be used uninitialized
in the format_provider::format caller.
Change HelperFunctions::consumeHexStyle to return an optional
HexPrintStyle and to make the fact that Str necessarily starts
with an "X" when all other cases do not apply more explicit.
This helps both the compiler and the human reader of the code.
Co-authored-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
0 files changed, 0 insertions, 0 deletions