=?utf-8?q?Félix?= Cloutier <fclout...@apple.com>, =?utf-8?q?Félix?= Cloutier <fclout...@apple.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/116...@github.com>
================ @@ -595,6 +595,97 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const { llvm_unreachable("Invalid ArgType Kind!"); } +static analyze_format_string::ArgType::MatchKind +integerTypeMatch(ASTContext &C, QualType A, QualType B, bool CheckSign) { + using MK = analyze_format_string::ArgType::MatchKind; + + uint64_t IntSize = C.getTypeSize(C.IntTy); + uint64_t ASize = C.getTypeSize(A); + uint64_t BSize = C.getTypeSize(B); + if (std::max(ASize, IntSize) != std::max(BSize, IntSize)) + return MK::NoMatch; + if (CheckSign && A->isSignedIntegerType() != B->isSignedIntegerType()) + return MK::NoMatchSignedness; + if (ASize != BSize) + return MK::MatchPromotion; + return MK::Match; +} + +analyze_format_string::ArgType::MatchKind +ArgType::matchesArgType(ASTContext &C, const ArgType &Other) const { + using AK = analyze_format_string::ArgType::Kind; + + // Per matchesType. + if (K == AK::InvalidTy || Other.K == AK::InvalidTy) + return NoMatch; + if (K == AK::UnknownTy || Other.K == AK::UnknownTy) ---------------- apple-fcloutier wrote: The AK enumeration declares neither. The format checker bails out from unspecialized template functions; not sure how to get an AutoTy value in this context, but I'm happy to check what happens if you can help me with that. https://github.com/llvm/llvm-project/pull/116708 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits