hazohelet added a comment.

Gcc can diagnose wider cases of overflow/truncation by specifying a higher 
level for it, like `-Wformat-overflow=2` (https://godbolt.org/z/n5facjW1c).
 The current clang counterpart only diagnoses when the format string is 
//always// larger than the buffer size. If we are going to implement more 
general warnings like gcc's, I think we should separate these counterparts into 
their own warning flags (`-Wformat-overflow/truncation`).



================
Comment at: clang/lib/Sema/SemaChecking.cpp:1134
   };
+  auto ProcessFormatStringLiteral =
+      [&](const Expr *FormatExpr, StringRef &FormatStrRef, size_t &StrLen) {
----------------
nickdesaulniers wrote:
> naive question, so will we create a lambda with capture even though a few 
> cases in the switch below will never use it?
I made it a static function.


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

https://reviews.llvm.org/D158562

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to