summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/warn-documentation.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-08-25 17:09:33 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-08-25 17:09:33 +0000
commit6080bdbec370d0d1f4202ce2d21e1ed4b090c6ff (patch)
treebe8ab7eb55453588b7efd0a62ab568e3df7604b8 /clang/test/Sema/warn-documentation.cpp
parentebbd8a9ef3824f4e5f45ed3eefb9be7ac7be1565 (diff)
downloadbcm5719-llvm-6080bdbec370d0d1f4202ce2d21e1ed4b090c6ff.tar.gz
bcm5719-llvm-6080bdbec370d0d1f4202ce2d21e1ed4b090c6ff.zip
[Sema][Comments] Add support for TypeAliasTemplate
Emit proper diagnostics when -Wdocumentation is used with constructs such as: template<typename T> using fn = int(T aaa, int ccc); Previously clang wouldn't recognize the function and complain with 'comment that is not attached to a function declaration'. Differential Revision: https://reviews.llvm.org/D23860 rdar://problem/27300695 llvm-svn: 279754
Diffstat (limited to 'clang/test/Sema/warn-documentation.cpp')
-rw-r--r--clang/test/Sema/warn-documentation.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp
index 2f2f44d6325..34d8f5fd2da 100644
--- a/clang/test/Sema/warn-documentation.cpp
+++ b/clang/test/Sema/warn-documentation.cpp
@@ -416,6 +416,38 @@ using test_function_like_using7 = foo::function_wrapper<int (int aaa, int ccc)>
/// \returns aaa.
using test_function_like_using8 = foo::function_wrapper<int (int aaa, int ccc)> &&;
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template<typename T>
+using test_function_like_using9 = int(T aaa, int ccc);
+
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template<typename T>
+using test_function_like_using10 = int (*)(T aaa, int ccc);
+
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template<typename T>
+using test_function_like_using11 = foo::function_wrapper<int (T aaa, int ccc)>;
+
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template<typename T>
+using test_function_like_using12 = foo::function_wrapper<int (T aaa, int ccc)> *;
+
using test_not_function_like_using1 = int (*)(int aaa);
// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
OpenPOWER on IntegriCloud