Comment parsing: fix a crash when dumping comment ast for a function template

with variadic parameters

Patch by Joe Ranieri.

llvm-svn: 204236
This commit is contained in:
Dmitri Gribenko 2014-03-19 14:03:47 +00:00
parent d9eb05aca3
commit dbff5c71fa
2 changed files with 9 additions and 1 deletions

View File

@ -2069,7 +2069,7 @@ void ASTDumper::visitParamCommandComment(const ParamCommandComment *C) {
OS << " Param=\"" << C->getParamNameAsWritten() << "\""; OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
} }
if (C->isParamIndexValid()) if (C->isParamIndexValid() && !C->isVarArgParam())
OS << " ParamIndex=" << C->getParamIndex(); OS << " ParamIndex=" << C->getParamIndex();
} }

View File

@ -67,3 +67,11 @@ int Test_VerbatimBlockComment;
// CHECK: VarDecl{{.*}}Test_VerbatimBlockComment // CHECK: VarDecl{{.*}}Test_VerbatimBlockComment
// CHECK: VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim" // CHECK: VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" Aaa" // 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"