[PATCH] D66186: [Sema] Don't warn on printf('%hd', [char]) (PR41467)

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 13:57:23 PDT 2019


lebedev.ri added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:8080-8083
+  analyze_printf::ArgType::MatchKind Match = AT.matchesType(S.Context, ExprTy);
   bool Pedantic = Match == analyze_printf::ArgType::NoMatchPedantic;
   if (Match == analyze_printf::ArgType::Match)
     return true;
----------------
`Match` isn't used outside of this block later on, so i don't think you need *this* change.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:8100-8107
+        // All further checking is done on the subexpression
+        Match = AT.matchesType(S.Context, ExprTy);
+        if (Match) {
+          if (Match == analyze_printf::ArgType::NoMatchPedantic)
+            Pedantic = true;
+          else
+            return true;
----------------
Just add a new variable
```
// All further checking is done on the subexpression
analyze_printf::ArgType::MatchKind Match2 = AT.matchesType(S.Context, ExprTy);
if (Match2 == analyze_printf::ArgType::Match)
  return true;
Pedantic |= Match2 == analyze_printf::ArgType::NoMatchPedantic;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66186/new/

https://reviews.llvm.org/D66186





More information about the cfe-commits mailing list