diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-09-19 18:13:34 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-09-19 18:13:34 +0000 |
commit | 29bf94d86fba0babf426e3d25abaae24dd9971bd (patch) | |
tree | d799b7ebbcc4e72f7f5f03f95cc0f051da646791 /clang/lib/Analysis/FormatString.cpp | |
parent | 8191d63c3bb4fb20afdc30a0681c072d18b6dcfc (diff) | |
download | bcm5719-llvm-29bf94d86fba0babf426e3d25abaae24dd9971bd.tar.gz bcm5719-llvm-29bf94d86fba0babf426e3d25abaae24dd9971bd.zip |
Sema: handle `wint_t` more carefully for printf checking
In the case that `win_t` is an `unsigned short` (e.g. on Windows), we would
previously incorrectly diagnose the conversion because we would immediately
promote the argument type from `wint_t` (aka `unsigned short`) to `int` before
checking if the type matched. This should repair the Windows hosted bots.
llvm-svn: 342565
Diffstat (limited to 'clang/lib/Analysis/FormatString.cpp')
-rw-r--r-- | clang/lib/Analysis/FormatString.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Analysis/FormatString.cpp b/clang/lib/Analysis/FormatString.cpp index f37e4affae3..0bab50c569f 100644 --- a/clang/lib/Analysis/FormatString.cpp +++ b/clang/lib/Analysis/FormatString.cpp @@ -406,12 +406,14 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const { } case WIntTy: { + QualType WInt = C.getCanonicalType(C.getWIntType()).getUnqualifiedType(); - QualType PromoArg = - argTy->isPromotableIntegerType() - ? C.getPromotedIntegerType(argTy) : argTy; + if (C.getCanonicalType(argTy).getUnqualifiedType() == WInt) + return Match; - QualType WInt = C.getCanonicalType(C.getWIntType()).getUnqualifiedType(); + QualType PromoArg = argTy->isPromotableIntegerType() + ? C.getPromotedIntegerType(argTy) + : argTy; PromoArg = C.getCanonicalType(PromoArg).getUnqualifiedType(); // If the promoted argument is the corresponding signed type of the |