Skip to content

Commit 6e14999

Browse files
committed
ASTDumper: Don't crash if capture info not computed yet
1 parent 37344ab commit 6e14999

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ namespace {
14021402
printField(PD->getDefaultArgumentKind(), "default_arg");
14031403
}
14041404
if (PD->hasDefaultExpr() &&
1405+
PD->getDefaultArgumentCaptureInfo().hasBeenComputed() &&
14051406
!PD->getDefaultArgumentCaptureInfo().isTrivial()) {
14061407
printFieldRaw([&](raw_ostream &OS) {
14071408
PD->getDefaultArgumentCaptureInfo().print(OS);
@@ -1488,7 +1489,8 @@ namespace {
14881489

14891490
void printCommonAFD(AbstractFunctionDecl *D, const char *Type, StringRef Label) {
14901491
printCommon(D, Type, Label, FuncColor);
1491-
if (!D->getCaptureInfo().isTrivial()) {
1492+
if (D->getCaptureInfo().hasBeenComputed() &&
1493+
!D->getCaptureInfo().isTrivial()) {
14921494
printFlagRaw([&](raw_ostream &OS) {
14931495
D->getCaptureInfo().print(OS);
14941496
});
@@ -2826,7 +2828,8 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, StringRef>,
28262828
break;
28272829
}
28282830

2829-
if (!E->getCaptureInfo().isTrivial()) {
2831+
if (E->getCaptureInfo().hasBeenComputed() &&
2832+
!E->getCaptureInfo().isTrivial()) {
28302833
printFieldRaw([&](raw_ostream &OS) {
28312834
E->getCaptureInfo().print(OS);
28322835
}, "", CapturesColor);

0 commit comments

Comments
 (0)