Skip to content

add missing symbols to compatibility-symbols #64510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

QuietMisdreavus
Copy link
Contributor

Resolves rdar://104389344

ClangMacros.def was missing three symbols in comparison to the macros and typedefs parsed by clang extract-api. This PR adds these missing symbols, as well as a test that uses clang -extract-api on a generated header to ensure that compatibility-symbols is kept up-to-date moving forward.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please smoke test

@@ -0,0 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %S/../Inputs/empty.swift -typecheck -emit-objc-header-path %t/empty.h
// RUN: %clang -extract-api -o %t/empty.symbols.json --target=%target-triple -isysroot %clang-importer-sdk-path -F %clang-importer-sdk-path/frameworks --extract-api-ignores=%swift_obj_root/share/swift/compatibility-symbols -fmodules -x objective-c-header %t/empty.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I got that right you run clang extract-api on a compatibility header and check that nothing ends up in the output? I still think the compatibility header has a module name dependent macro in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. The header guard macro is being filtered out here by clang's own filtering. It's not a problem here, but if we were to (e.g.) run extract-api on a header that was merged together by Xcode, it would be a problem there. The merging behavior disrupts Clang's header-guard detection, because there the first thing in the file isn't the header-guard declaration, but a processor arch check. I'm not sure the best way to handle that, especially since all we are able to provide to Clang is a static file that we install in the toolchain.

Copy link
Contributor

@daniel-grumberg daniel-grumberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus QuietMisdreavus merged commit 8981535 into main Apr 3, 2023
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/compatibility-test branch April 3, 2023 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants