Skip to content

Commit ac37e01

Browse files
committed
[clang-doc] Fix assertions error in Serialize.cpp
We can only print and use a default arg, if it is instantiated. I was unable to reduce the test case for this to something of reasonable size, but this is easily hit by running clang-doc to generate clang's documentation. For now, we can fix the assertion quickly to unbreak users, and add the proper test once it is small enough.
1 parent c3656af commit ac37e01

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ getFunctionPrototype(const FunctionDecl *FuncDecl) {
113113
Stream << " " << ParamDecl->getNameAsString();
114114

115115
// Print default argument if it exists
116-
if (ParamDecl->hasDefaultArg()) {
117-
const Expr *DefaultArg = ParamDecl->getDefaultArg();
118-
if (DefaultArg) {
116+
if (ParamDecl->hasDefaultArg() && !ParamDecl->hasUninstantiatedDefaultArg()) {
117+
if(const Expr *DefaultArg = ParamDecl->getDefaultArg()) {
119118
Stream << " = ";
120119
DefaultArg->printPretty(Stream, nullptr, Ctx.getPrintingPolicy());
121120
}

0 commit comments

Comments
 (0)