r204236 - Comment parsing: fix a crash when dumping comment ast for a function template
Dmitri Gribenko
gribozavr at gmail.com
Wed Mar 19 07:03:47 PDT 2014
Author: gribozavr
Date: Wed Mar 19 09:03:47 2014
New Revision: 204236
URL: http://llvm.org/viewvc/llvm-project?rev=204236&view=rev
Log:
Comment parsing: fix a crash when dumping comment ast for a function template
with variadic parameters
Patch by Joe Ranieri.
Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/test/Misc/ast-dump-comment.cpp
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=204236&r1=204235&r2=204236&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Mar 19 09:03:47 2014
@@ -2069,7 +2069,7 @@ void ASTDumper::visitParamCommandComment
OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
}
- if (C->isParamIndexValid())
+ if (C->isParamIndexValid() && !C->isVarArgParam())
OS << " ParamIndex=" << C->getParamIndex();
}
Modified: cfe/trunk/test/Misc/ast-dump-comment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-comment.cpp?rev=204236&r1=204235&r2=204236&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-comment.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-comment.cpp Wed Mar 19 09:03:47 2014
@@ -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"
More information about the cfe-commits
mailing list