Updated to Clang 3.5a.
Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp
index 7166a49..ed25d94 100644
--- a/test/Sema/warn-documentation.cpp
+++ b/test/Sema/warn-documentation.cpp
@@ -167,7 +167,13 @@
// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
/// \param a Blah blah.
-int test_param1;
+int test_param1_backslash;
+
+// rdar://13066276
+// Check that the diagnostic uses the same command marker as the comment.
+// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
+/// @param a Blah blah.
+int test_param1_at;
// expected-warning@+1 {{empty paragraph passed to '\param' command}}
/// \param
@@ -269,41 +275,85 @@
/// \param x2 Ccc.
int test_param22(int x1, int x2, int x3);
-// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
-/// \param aaa Meow.
-/// \param bbb Bbb.
-/// \returns aaa.
-typedef int test_param23(int aaa, int ccc);
+//===---
+// Test that we treat typedefs to some non-function types as functions for the
+// purposes of documentation comment parsing.
+//===---
+
+namespace foo {
+ inline namespace bar {
+ template<typename>
+ struct function_wrapper {};
+
+ template<unsigned>
+ struct not_a_function_wrapper {};
+ }
+};
// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
/// \param aaa Meow.
/// \param bbb Bbb.
/// \returns aaa.
-typedef int (*test_param24)(int aaa, int ccc);
+typedef int test_function_like_typedef1(int aaa, int ccc);
// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
/// \param aaa Meow.
/// \param bbb Bbb.
/// \returns aaa.
-typedef int (* const test_param25)(int aaa, int ccc);
+typedef int (*test_function_like_typedef2)(int aaa, int ccc);
// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
/// \param aaa Meow.
/// \param bbb Bbb.
/// \returns aaa.
-typedef int (C::*test_param26)(int aaa, int ccc);
+typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
-typedef int (*test_param27)(int aaa);
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
+
+
+typedef int (*test_not_function_like_typedef1)(int aaa);
// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
/// \param aaa Meow.
-typedef test_param27 test_param28;
+typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
// rdar://13066276
+// Check that the diagnostic uses the same command marker as the comment.
// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
/// @param aaa Meow.
-typedef unsigned int test_param29;
+typedef unsigned int test_not_function_like_typedef3;
+// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
+/// \param aaa Meow.
+typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
/// \param aaa Aaa
/// \param ... Vararg
@@ -321,6 +371,26 @@
int test_vararg_param4();
+/// \param aaa Aaa
+/// \param ... Vararg
+template<typename T>
+int test_template_vararg_param1(int aaa, ...);
+
+/// \param ... Vararg
+template<typename T>
+int test_template_vararg_param2(...);
+
+// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
+/// \param ... Vararg
+template<typename T>
+int test_template_vararg_param3(int aaa);
+
+// expected-warning@+1 {{parameter '...' not found in the function declaration}}
+/// \param ... Vararg
+template<typename T>
+int test_template_vararg_param4();
+
+
// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
/// \tparam T Aaa
int test_tparam1;
@@ -503,7 +573,13 @@
// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
/// \returns Aaa
-int test_returns_wrong_decl_1;
+int test_returns_wrong_decl_1_backslash;
+
+// rdar://13066276
+// Check that the diagnostic uses the same command marker as the comment.
+// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
+/// @returns Aaa
+int test_returns_wrong_decl_1_at;
// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
/// \return Aaa
@@ -555,11 +631,6 @@
/// \returns Aaa
namespace test_returns_wrong_decl_10 { };
-// rdar://13066276
-// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
-/// @returns Aaa
-typedef unsigned int test_returns_wrong_decl_11;
-
// rdar://13094352
// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
/*! @function test_function