[clang] [llvm] [Sema] Implement support for -Wformat-signedness (PR #74440)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 06:35:41 PDT 2024
================
@@ -12465,6 +12465,20 @@ isArithmeticArgumentPromotion(Sema &S, const ImplicitCastExpr *ICE) {
S.Context.getFloatingTypeOrder(From, To) < 0;
}
+static analyze_format_string::ArgType::MatchKind
+handleFormatSignedness(analyze_format_string::ArgType::MatchKind Match,
+ DiagnosticsEngine &Diags, SourceLocation Loc) {
+ if (Match == analyze_format_string::ArgType::NoMatchSignedness) {
+ if (!Diags.isIgnored(
+ diag::warn_format_conversion_argument_type_mismatch_signedness,
+ Loc))
+ Match = analyze_format_string::ArgType::NoMatch;
+ else
+ Match = analyze_format_string::ArgType::Match;
----------------
AaronBallman wrote:
```suggestion
Match = Diags.isIgnored(
diag::warn_format_conversion_argument_type_mismatch_signedness,
Loc) ? analyze_format_string::ArgType::Match : analyze_format_string::ArgType::NoMatch;
```
Probably need to be reformatted, but makes the code a little bit more clear (IMO).
https://github.com/llvm/llvm-project/pull/74440
More information about the cfe-commits
mailing list