From: Dmitri Gribenko Date: Wed, 19 Mar 2014 14:03:47 +0000 (+0000) Subject: Comment parsing: fix a crash when dumping comment ast for a function template X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1cde496a9806c0bc93cd589cac949d2c1611bb06;p=clang Comment parsing: fix a crash when dumping comment ast for a function template with variadic parameters Patch by Joe Ranieri. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204236 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index eb5a7d3b05..54efed289a 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -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(); } diff --git a/test/Misc/ast-dump-comment.cpp b/test/Misc/ast-dump-comment.cpp index 4e84af01a5..5bd6934d80 100644 --- a/test/Misc/ast-dump-comment.cpp +++ b/test/Misc/ast-dump-comment.cpp @@ -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 +void Test_TemplatedFunctionVariadic(int arg, ...); +// CHECK: FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic +// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..." +// CHECK-NEXT: ParagraphComment +// CHECK-NEXT: TextComment{{.*}} Text=" More arguments"