Skip to content

Commit 0ca4be1

Browse files
danix800arichardson
authored andcommitted
[Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl
BlockDecl should be invalidated because of its invalid ParmVarDecl. Fixes #1 of llvm/llvm-project#64005 Differential Revision: https://reviews.llvm.org/D155984
2 parents 6fcc90e + 3cb16f6 commit 0ca4be1

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

clang/docs/ReleaseNotes.rst

+2
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ Bug Fixes in This Version
674674
value exprs is invalid. Propagating the error info up by replacing BlockExpr
675675
with a RecoveryExpr. This fixes:
676676
(`#63863 <https://github.com/llvm/llvm-project/issues/63863>_`)
677+
- Invalidate BlockDecl with invalid ParmVarDecl
678+
(`#64005 <https://github.com/llvm/llvm-project/issues/64005>_`)
677679

678680
Bug Fixes to Compiler Builtins
679681
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaExpr.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -17224,6 +17224,9 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
1722417224

1722517225
PushOnScopeChains(AI, CurBlock->TheScope);
1722617226
}
17227+
17228+
if (AI->isInvalidDecl())
17229+
CurBlock->TheDecl->setInvalidDecl();
1722717230
}
1722817231
}
1722917232

clang/test/AST/ast-dump-recovery.m

+6
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ void k(Foo *foo) {
2424
int (^gh63863)() = ^() {
2525
return undef;
2626
};
27+
28+
// CHECK: `-BlockExpr {{.*}} 'int (^)(int, int)'
29+
// CHECK-NEXT: `-BlockDecl {{.*}} invalid
30+
int (^gh64005)(int, int) = ^(int, undefined b) {
31+
return 1;
32+
};

0 commit comments

Comments
 (0)