]> granicus.if.org Git - clang/commitdiff
Comment parsing: fix a crash when dumping comment ast for a function template
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 19 Mar 2014 14:03:47 +0000 (14:03 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 19 Mar 2014 14:03:47 +0000 (14:03 +0000)
with variadic parameters

Patch by Joe Ranieri.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204236 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDumper.cpp
test/Misc/ast-dump-comment.cpp

index eb5a7d3b05d58fad2a37045d134427ce2d1a3caf..54efed289a6e03980a3871877f6a3663ea738d37 100644 (file)
@@ -2069,7 +2069,7 @@ void ASTDumper::visitParamCommandComment(const ParamCommandComment *C) {
       OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
   }
 
-  if (C->isParamIndexValid())
+  if (C->isParamIndexValid() && !C->isVarArgParam())
     OS << " ParamIndex=" << C->getParamIndex();
 }
 
index 4e84af01a5169e406bbf4c3240de1db17c5e4413..5bd6934d80cf568b4d055e722c25b811bad1a115 100644 (file)
@@ -67,3 +67,11 @@ int Test_VerbatimBlockComment;
 // CHECK:      VarDecl{{.*}}Test_VerbatimBlockComment
 // CHECK:        VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
 // CHECK-NEXT:     VerbatimBlockLineComment{{.*}} Text=" Aaa"
+
+/// \param ... More arguments
+template<typename T>
+void Test_TemplatedFunctionVariadic(int arg, ...);
+// CHECK:      FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic
+// CHECK:        ParamCommandComment{{.*}} [in] implicitly Param="..."
+// CHECK-NEXT:     ParagraphComment
+// CHECK-NEXT:       TextComment{{.*}} Text=" More arguments"