[PATCH] D155984: [Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

2023-07-24 Thread Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3cb16f6d2ddd: [Sema][ObjC] Invalidate BlockDecl with invalid 
ParmVarDecl (authored by dingfei fd...@feysh.com).

Changed prior to commit:
  https://reviews.llvm.org/D155984?vs=543005=543451#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155984/new/

https://reviews.llvm.org/D155984

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaExpr.cpp
  clang/test/AST/ast-dump-recovery.m


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -24,3 +24,9 @@
 int (^gh63863)() = ^() {
   return undef;
 };
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^gh64005)(int, int) = ^(int, undefined b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -674,6 +674,8 @@
   value exprs is invalid. Propagating the error info up by replacing BlockExpr
   with a RecoveryExpr. This fixes:
   (`#63863 _`)
+- Invalidate BlockDecl with invalid ParmVarDecl
+  (`#64005 _`)
 
 Bug Fixes to Compiler Builtins
 ^^


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -24,3 +24,9 @@
 int (^gh63863)() = ^() {
   return undef;
 };
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^gh64005)(int, int) = ^(int, undefined b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -674,6 +674,8 @@
   value exprs is invalid. Propagating the error info up by replacing BlockExpr
   with a RecoveryExpr. This fixes:
   (`#63863 _`)
+- Invalidate BlockDecl with invalid ParmVarDecl
+  (`#64005 _`)
 
 Bug Fixes to Compiler Builtins
 ^^
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D155984: [Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

2023-07-24 Thread Ding Fei via Phabricator via cfe-commits
danix800 marked an inline comment as done.
danix800 added inline comments.



Comment at: clang/test/AST/ast-dump-recovery.m:22
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;

hokein wrote:
> nit: a => `gh64005`
Will be fixed in the final commit!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155984/new/

https://reviews.llvm.org/D155984

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D155984: [Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

2023-07-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

thanks, the fix looks reasonable to me




Comment at: clang/test/AST/ast-dump-recovery.m:22
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;

nit: a => `gh64005`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155984/new/

https://reviews.llvm.org/D155984

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D155984: [Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

2023-07-21 Thread Ding Fei via Phabricator via cfe-commits
danix800 updated this revision to Diff 543005.
danix800 added a comment.

Update ReleaseNotes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155984/new/

https://reviews.llvm.org/D155984

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaExpr.cpp
  clang/test/AST/ast-dump-recovery.m


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -16,3 +16,9 @@
   // CHECK-NEXT:   `-DeclRefExpr {{.*}} 'foo'
   foo.undef;
 }
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -663,6 +663,8 @@
 - Correcly diagnose jumps into statement expressions.
   This ensures the behavior of Clang is consistent with GCC.
   (`#63682 `_)
+- Invalidate BlockDecl with invalid ParmVarDecl
+  (`#64005 _`)
 
 Bug Fixes to Compiler Builtins
 ^^


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -16,3 +16,9 @@
   // CHECK-NEXT:   `-DeclRefExpr {{.*}} 'foo'
   foo.undef;
 }
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -663,6 +663,8 @@
 - Correcly diagnose jumps into statement expressions.
   This ensures the behavior of Clang is consistent with GCC.
   (`#63682 `_)
+- Invalidate BlockDecl with invalid ParmVarDecl
+  (`#64005 _`)
 
 Bug Fixes to Compiler Builtins
 ^^
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D155984: [Sema][ObjC] Invalidate BlockDecl with invalid ParmVarDecl

2023-07-21 Thread Ding Fei via Phabricator via cfe-commits
danix800 created this revision.
danix800 added reviewers: hokein, aaron.ballman.
danix800 added a project: clang.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
danix800 requested review of this revision.
Herald added a subscriber: cfe-commits.

`BlockDecl` should be invalidated because of its invalid `ParmVarDecl`.

Fixes #1 of https://github.com/llvm/llvm-project/issues/64005


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155984

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/AST/ast-dump-recovery.m


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -16,3 +16,9 @@
   // CHECK-NEXT:   `-DeclRefExpr {{.*}} 'foo'
   foo.undef;
 }
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 


Index: clang/test/AST/ast-dump-recovery.m
===
--- clang/test/AST/ast-dump-recovery.m
+++ clang/test/AST/ast-dump-recovery.m
@@ -16,3 +16,9 @@
   // CHECK-NEXT:   `-DeclRefExpr {{.*}} 'foo'
   foo.undef;
 }
+
+// CHECK:  `-BlockExpr {{.*}} 'int (^)(int, int)'
+// CHECK-NEXT:   `-BlockDecl {{.*}} invalid
+int (^a)(int, int) = ^(int, undefine b) {
+   return 1;
+};
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16959,6 +16959,9 @@
 
   PushOnScopeChains(AI, CurBlock->TheScope);
 }
+
+if (AI->isInvalidDecl())
+  CurBlock->TheDecl->setInvalidDecl();
   }
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits