[PATCH] D15636: Reduce false positives in printf/scanf format checker

Andy Gibbs via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 07:30:28 PST 2016


AndyG added inline comments.

================
Comment at: lib/Sema/SemaChecking.cpp:3923-3924
@@ +3922,4 @@
+  PartialDiagnostic PDiag = S.PDiag(diag::warn_printf_data_arg_not_used);
+  for (unsigned i = 1; i < DiagnosticExprs.size(); ++i)
+    PDiag << DiagnosticExprs[i]->getSourceRange();
+
----------------
rtrieu wrote:
> That raises the question why the first element is different from the rest.
I've put this as a range-based for-loop as requested.  The reason it wasn't before is that one expression is passed through the call to EmitFormatDiagnostic.  Ultimately, I think EmitFormatDiagnostic needs to be reworked to support multiple format strings - and this will probably resolve the FIXME relating to the missing diagnostic note in the tests.


http://reviews.llvm.org/D15636





More information about the cfe-commits mailing list