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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 14:24:48 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:8106
+          if (ImplicitMatch == analyze_printf::ArgType::NoMatchPedantic)
+            Pedantic |= true;
+          else
----------------
I don't think this needs to use `|= true`. If `Pedantic` was true, this is a noop. If it was false, this sets it to true. Either way the value is true, so I think it should just be `Pedantic = true;` The logic gets easier if you write this as:
```
if (ImplicitMatch && ImplicitMatch != analyze_printf::ArgType::NoMatchPedantic)
  return true;
Pedantic |= ImplicitMatch;
```


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