[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 23 06:13:03 PDT 2023
aaron.ballman added a comment.
I just realized that we may need some additional test coverage for `scanf`, as that interface also uses `ArgType::matchesType()`: https://github.com/llvm/llvm-project/blob/5686f06d7fc02b7e2ab1eceb56f3830b6fdf7301/clang/lib/AST/ScanfFormatString.cpp#L511 but I think that's the last thing remaining on the patch.
================
Comment at: clang/lib/AST/FormatString.cpp:480-481
+ break;
+ case BuiltinType::Half:
+ case BuiltinType::Float16:
+ case BuiltinType::Float:
----------------
fcloutier wrote:
> aaron.ballman wrote:
> > Should these be checking for `T == C.FloatTy` to return `NoMatchPromotionTypeConfusion`?
> I don't think it's necessary. `T` is the format specifier's expected type, and no format specifier expects a `float` (due to floating-point types being promoted to `double` by default argument promotion), so there's never a case where `T` is `FloatTy`.
Ah good point!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158318/new/
https://reviews.llvm.org/D158318
More information about the cfe-commits
mailing list