Skip to content

Commit

Permalink
[clang][ASTDumper] Remove redundant dump of BlockDecl's ParmVarDecl
Browse files Browse the repository at this point in the history
ParmVarDecl of BlockDecl is unnecessarily dumped twice.
Remove this duplication as other FunctionDecls.

Fixes #64005 (#2)

Differential Revision: https://reviews.llvm.org/D155985
  • Loading branch information
danix800 committed Jul 24, 2023
1 parent 454bea0 commit 4b15bb9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
3 changes: 2 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ Bug Fixes in This Version
value exprs is invalid. Propagating the error info up by replacing BlockExpr
with a RecoveryExpr. This fixes:
(`#63863 <https://github.com/llvm/llvm-project/issues/63863>_`)
- Invalidate BlockDecl with invalid ParmVarDecl
- Invalidate BlockDecl with invalid ParmVarDecl. Remove redundant dump of
BlockDecl's ParmVarDecl
(`#64005 <https://github.com/llvm/llvm-project/issues/64005>_`)

Bug Fixes to Compiler Builtins
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/ASTNodeTraverser.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class ASTNodeTraverser
Visit(Comment, Comment);

// Decls within functions are visited by the body.
if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) {
if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
!isa<BlockDecl>(*D)) {
if (Traversal != TK_AsIs) {
if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
auto SK = CTSD->getSpecializationKind();
Expand Down
25 changes: 0 additions & 25 deletions clang/test/AST/ast-dump-decl-json.m
Original file line number Diff line number Diff line change
Expand Up @@ -1924,31 +1924,6 @@ void f(void) {
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "offset": {{[0-9]+}},
// CHECK-NEXT: "col": 9,
// CHECK-NEXT: "tokLen": 1
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "offset": {{[0-9]+}},
// CHECK-NEXT: "col": 5,
// CHECK-NEXT: "tokLen": 3
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "offset": {{[0-9]+}},
// CHECK-NEXT: "col": 9,
// CHECK-NEXT: "tokLen": 1
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "y",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
Expand Down
5 changes: 5 additions & 0 deletions clang/test/AST/ast-dump-decl.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ @implementation TestObjCProperty {

void TestBlockDecl(int x) {
^(int y, ...){ x; };
int z;
}
// CHECK: FunctionDecl{{.*}}TestBlockDecl
// CHECK: BlockDecl {{.+}} <col:3, col:21> col:3 variadic
// CHECK-NEXT: ParmVarDecl{{.*}} y 'int'
// CHECK-NEXT: capture ParmVar{{.*}} 'x' 'int'
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr{{.*}} 'x'
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl{{.*}} z

@interface B
+ (int) foo;
Expand Down

0 comments on commit 4b15bb9

Please sign in to comment.