aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/AST/FormatString.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/FormatString.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/AST/FormatString.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/FormatString.cpp b/contrib/llvm-project/clang/lib/AST/FormatString.cpp
index ad5af9508983..e0c9e18cfe3a 100644
--- a/contrib/llvm-project/clang/lib/AST/FormatString.cpp
+++ b/contrib/llvm-project/clang/lib/AST/FormatString.cpp
@@ -368,8 +368,11 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
case BuiltinType::SChar:
case BuiltinType::UChar:
case BuiltinType::Char_U:
+ return Match;
case BuiltinType::Bool:
- return Match;
+ if (!Ptr)
+ return Match;
+ break;
}
// "Partially matched" because of promotions?
if (!Ptr) {
@@ -410,11 +413,14 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
switch (BT->getKind()) {
default:
break;
+ case BuiltinType::Bool:
+ if (Ptr && (T == C.UnsignedCharTy || T == C.SignedCharTy))
+ return NoMatch;
+ [[fallthrough]];
case BuiltinType::Char_S:
case BuiltinType::SChar:
case BuiltinType::Char_U:
case BuiltinType::UChar:
- case BuiltinType::Bool:
if (T == C.UnsignedShortTy || T == C.ShortTy)
return NoMatchTypeConfusion;
if (T == C.UnsignedCharTy || T == C.SignedCharTy)
@@ -458,6 +464,10 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
switch (BT->getKind()) {
default:
break;
+ case BuiltinType::Bool:
+ if (T == C.IntTy || T == C.UnsignedIntTy)
+ return MatchPromotion;
+ break;
case BuiltinType::Int:
case BuiltinType::UInt:
if (T == C.SignedCharTy || T == C.UnsignedCharTy ||
@@ -465,6 +475,24 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
T == C.WideCharTy)
return MatchPromotion;
break;
+ case BuiltinType::Char_U:
+ if (T == C.UnsignedIntTy)
+ return MatchPromotion;
+ if (T == C.UnsignedShortTy)
+ return NoMatchPromotionTypeConfusion;
+ break;
+ case BuiltinType::Char_S:
+ if (T == C.IntTy)
+ return MatchPromotion;
+ if (T == C.ShortTy)
+ return NoMatchPromotionTypeConfusion;
+ break;
+ case BuiltinType::Half:
+ case BuiltinType::Float16:
+ case BuiltinType::Float:
+ if (T == C.DoubleTy)
+ return MatchPromotion;
+ break;
case BuiltinType::Short:
case BuiltinType::UShort:
if (T == C.SignedCharTy || T == C.UnsignedCharTy)