Skip to content

Commit 677acd4

Browse files
authored
Merge pull request #42497 from apple/QuietMisdreavus/5.7-04182022/new-symbols
[5.7-04182022][SymbolGraphGen] skip underscored implicit Clang decls
2 parents a0478d0 + 5f13e02 commit 677acd4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/SymbolGraphGen/SymbolGraph.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,12 @@ bool SymbolGraph::isImplicitlyPrivate(const Decl *D,
583583

584584
// Don't record effectively internal declarations if specified
585585
if (D->hasUnderscoredNaming()) {
586+
// Some implicit decls from Clang with underscored names sneak in, so throw those out
587+
if (const auto *clangD = D->getClangDecl()) {
588+
if (clangD->isImplicit())
589+
return true;
590+
}
591+
586592
AccessLevel symLevel = AccessLevel::Public;
587593
if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
588594
symLevel = VD->getFormalAccess();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-pch -pch-output-dir %t %S/Inputs/ObjcProperty/ObjcProperty.framework/Headers/ObjcProperty.h
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -emit-module-path %t/BridgingHeader.swiftmodule -import-objc-header %S/Inputs/ObjcProperty/ObjcProperty.framework/Headers/ObjcProperty.h -pch-output-dir %t -module-name BridgingHeader -disable-objc-attr-requires-foundation-module %s -emit-symbol-graph -emit-symbol-graph-dir %t -symbol-graph-minimum-access-level internal
4+
5+
// RUN: %FileCheck %s --input-file %t/BridgingHeader.symbols.json
6+
7+
// REQUIRES: objc_interop
8+
9+
// There are a few implicit symbols from Clang that snuck in when building with minimum-access
10+
// level of "internal". Make sure they don't sneak back in. rdar://92018648
11+
12+
// CHECK-NOT: __NSConstantString
13+
// CHECK-NOT: __builtin_ms_va_list
14+
// CHECK-NOT: __builtin_va_list
15+

0 commit comments

Comments
 (0)