diff options
author | Nathan Huckleberry <nhuck@google.com> | 2019-08-23 18:01:57 +0000 |
---|---|---|
committer | Nathan Huckleberry <nhuck@google.com> | 2019-08-23 18:01:57 +0000 |
commit | cc01d6421f4a896820c02da2ea92b82d973b431e (patch) | |
tree | 90e9cb68fbceb82f0bc4438cd5654833dcf1aa1f /clang/lib/Sema/SemaChecking.cpp | |
parent | 30232770fbe5f5df7d5d01bd418c5ef9cc76b75e (diff) | |
download | bcm5719-llvm-cc01d6421f4a896820c02da2ea92b82d973b431e.tar.gz bcm5719-llvm-cc01d6421f4a896820c02da2ea92b82d973b431e.zip |
[Sema] Don't warn on printf('%hd', [char]) (PR41467)
Summary: Link: https://bugs.llvm.org/show_bug.cgi?id=41467
Reviewers: rsmith, nickdesaulniers, aaron.ballman, lebedev.ri
Reviewed By: nickdesaulniers, aaron.ballman, lebedev.ri
Subscribers: lebedev.ri, nickdesaulniers, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66186
llvm-svn: 369791
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 07db04e4ffb..1b6390adc48 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -8119,9 +8119,13 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, // function. if (ICE->getType() == S.Context.IntTy || ICE->getType() == S.Context.UnsignedIntTy) { - // All further checking is done on the subexpression. - if (AT.matchesType(S.Context, ExprTy)) + // All further checking is done on the subexpression + const analyze_printf::ArgType::MatchKind ImplicitMatch = + AT.matchesType(S.Context, ExprTy); + if (ImplicitMatch == analyze_printf::ArgType::Match) return true; + if (ImplicitMatch == analyze_printf::ArgType::NoMatchPedantic) + Pedantic = true; } } } else if (const CharacterLiteral *CL = dyn_cast<CharacterLiteral>(E)) { |