Author: gribozavr
Date: Tue Dec 17 16:22:14 2013
New Revision: 197530

URL: http://llvm.org/viewvc/llvm-project?rev=197530&view=rev
Log:
Documentation comment parsing: when checking if we have typedef to something
that we consider a function for the purposes of checking \param and \returns,
look through reference types.

Modified:
    cfe/trunk/lib/AST/Comment.cpp
    cfe/trunk/test/Sema/warn-documentation.cpp

Modified: cfe/trunk/lib/AST/Comment.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Comment.cpp?rev=197530&r1=197529&r2=197530&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Tue Dec 17 16:22:14 2013
@@ -251,6 +251,11 @@ void DeclInfo::fill() {
         TL = PointerTL.getPointeeLoc().getUnqualifiedLoc();
         continue;
       }
+      // Look through reference types.
+      if (ReferenceTypeLoc ReferenceTL = TL.getAs<ReferenceTypeLoc>()) {
+        TL = ReferenceTL.getPointeeLoc().getUnqualifiedLoc();
+        continue;
+      }
       // Look through adjusted types.
       if (AdjustedTypeLoc ATL = TL.getAs<AdjustedTypeLoc>()) {
         TL = ATL.getOriginalLoc();

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=197530&r1=197529&r2=197530&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Tue Dec 17 16:22:14 2013
@@ -326,6 +326,18 @@ typedef foo::function_wrapper<int (int a
 /// \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);
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to