]> granicus.if.org Git - clang/commit
Add a -Wclass-varargs to warn on objects of any class type being passed through an...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 28 Feb 2014 01:36:39 +0000 (01:36 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 28 Feb 2014 01:36:39 +0000 (01:36 +0000)
commit93fe566800e0a636442b4b61247c57b08de952c5
tree02998c0b8933f906c490d302d2e0308cc104b755
parentea890c87c825a3cc4b00f0fb81e1c6a40eb53f5a
Add a -Wclass-varargs to warn on objects of any class type being passed through an ellipsis. Since C++11 relaxed the rules on this, we allow a lot more bad code through silently, such as:

  const char *format = "%s";
  std::experimental::string_view view = "foo";
  printf(format, view);

In this case, not only warn about a class type being used here, but also suggest that calling c_str() might be a good idea.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202461 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaChecking.cpp
lib/Sema/SemaExpr.cpp
test/SemaCXX/vararg-class.cpp [new file with mode: 0644]