Warn on va_start() when called with a reference parameter.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 18.7p3
explicitly calls this (and some other things) out as undefined.
Also move 2 other existing warnings behind the new -Wvarargs flag.
llvm-svn: 182694
diff --git a/clang/test/Sema/varargs.cpp b/clang/test/Sema/varargs.cpp
new file mode 100644
index 0000000..48a7b2f
--- /dev/null
+++ b/clang/test/Sema/varargs.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class string;
+void f(const string& s, ...) { // expected-note {{parameter of type 'const string &' is declared here}}
+ __builtin_va_list ap;
+ __builtin_va_start(ap, s); // expected-warning {{'va_start' has undefined behavior with reference types}}
+}