Skip to content

Commit f53a135

Browse files
don't skip walking VarDecls from parent clang nodes
rdar://80235766
1 parent 4af6188 commit f53a135

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

lib/AST/ASTWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
12511251
D->getDeclContext()->getParentSourceFile())
12521252
return true;
12531253
if (Decl *ParentD = Walker.Parent.getAsDecl())
1254-
return (isa<NominalTypeDecl>(ParentD) || isa<ExtensionDecl>(ParentD));
1254+
return (!D->hasClangNode() && (isa<NominalTypeDecl>(ParentD) || isa<ExtensionDecl>(ParentD)));
12551255
auto walkerParentAsStmt = Walker.Parent.getAsStmt();
12561256
if (walkerParentAsStmt && isa<BraceStmt>(walkerParentAsStmt))
12571257
return true;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@import Foundation;
2+
3+
@class Foo;
4+
5+
@interface Foo : NSObject
6+
7+
@property (nullable, strong, nonatomic) NSDate *today;
8+
9+
- (void)selectDate:(nullable NSDate *)date;
10+
11+
@end
12+

test/SymbolGraph/ClangImporter/Inputs/ObjcProperty/ObjcProperty.framework/Modules/ObjcProperty.swiftmodule/.keep

Whitespace-only changes.

test/SymbolGraph/ClangImporter/Inputs/ObjcProperty/ObjcProperty.framework/ObjcProperty

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework module ObjcProperty {
2+
header "ObjcProperty.h"
3+
export *
4+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp -r %S/Inputs/ObjcProperty/ObjcProperty.framework %t
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-module -o %t/ObjcProperty.framework/Modules/ObjcProperty.swiftmodule/%target-swiftmodule-name -import-underlying-module -F %t -module-name ObjcProperty -disable-objc-attr-requires-foundation-module %s
4+
// RUN: %target-swift-symbolgraph-extract -sdk %clang-importer-sdk -module-name ObjcProperty -F %t -output-dir %t -pretty-print -v
5+
// RUN: %FileCheck %s --input-file %t/ObjcProperty.symbols.json
6+
7+
// REQUIRES: objc_interop
8+
9+
import Foundation
10+
11+
public enum SwiftEnum {}
12+
13+
// CHECK: "precise": "c:objc(cs)Foo(py)today"

0 commit comments

Comments
 (0)