[cfe-commits] r163985 - in /cfe/trunk: lib/AST/Comment.cpp test/Sema/warn-documentation.cpp

Dmitri Gribenko gribozavr at gmail.com
Sat Sep 15 14:13:36 PDT 2012


Author: gribozavr
Date: Sat Sep 15 16:13:36 2012
New Revision: 163985

URL: http://llvm.org/viewvc/llvm-project?rev=163985&view=rev
Log:
Comment parsing: don't treat typedef to a typedef to a function as a
'function-like' type that can be annotated with \param.

Thanks to Eli Friedman for noticing!

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=163985&r1=163984&r2=163985&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Sat Sep 15 16:13:36 2012
@@ -253,14 +253,6 @@
     TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc();
     while (true) {
       TL = TL.IgnoreParens();
-      // Look through typedefs.
-      if (TypedefTypeLoc *TypedefTL = dyn_cast<TypedefTypeLoc>(&TL)) {
-        TSI = TypedefTL->getTypedefNameDecl()->getTypeSourceInfo();
-        if (TSI)
-          break;
-        TL = TSI->getTypeLoc().getUnqualifiedLoc();
-        continue;
-      }
       // Look through qualified types.
       if (QualifiedTypeLoc *QualifiedTL = dyn_cast<QualifiedTypeLoc>(&TL)) {
         TL = QualifiedTL->getUnqualifiedLoc();

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=163985&r1=163984&r2=163985&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Sat Sep 15 16:13:36 2012
@@ -297,6 +297,12 @@
 /// \returns aaa.
 typedef int (C::*test_param26)(int aaa, int ccc);
 
+typedef int (*test_param27)(int aaa);
+
+// expected-warning at +1 {{'\param' command used in a comment that is not attached to a function declaration}}
+/// \param aaa Meow.
+typedef test_param27 test_param28;
+
 
 // expected-warning at +1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
 /// \tparam T Aaa





More information about the cfe-commits mailing list