Skip to content

Commit 0dca99f

Browse files
ilovepisvkeerthy
authored andcommitted
[clang-doc] Fix assertions error in Serialize.cpp (#141990)
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 e0b81b0 commit 0dca99f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ 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() &&
117+
!ParamDecl->hasUninstantiatedDefaultArg()) {
118+
if (const Expr *DefaultArg = ParamDecl->getDefaultArg()) {
119119
Stream << " = ";
120120
DefaultArg->printPretty(Stream, nullptr, Ctx.getPrintingPolicy());
121121
}

0 commit comments

Comments
 (0)