-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Fix a rare compilation error in reverse interop header #80598
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
Conversation
lib/ClangImporter/ClangImporter.cpp
Outdated
|
||
bool importer::isClangNamespace(const DeclContext *dc) { | ||
if (const auto *ed = dc->getSelfEnumDecl()) | ||
return llvm::isa_and_nonnull<clang::NamespaceDecl>(ed->getClangDecl()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: redundant llvm::
// RUN: cat %t/UseCxxTy.h >> %t/full-header.h | ||
// RUN: %target-interop-build-clangxx -std=c++20 -c -xc++-header %t/full-header.h -o %t/o.o | ||
|
||
// UN: %FileCheck %s < %t/UseCxxTy.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this UN:
supposed to be RUN:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, this is a line I wanted to remove. Thanks for catching this!
To trigger this error one needs to import a nested type from C++, use it in a generic context in Swift, and export it back to C++. We were inconsisent in what namespace did we declare the functions to get the type metadata for types. It was in the swift namespace for foreign types and in the module namespace for Swift types. This PR standardizes on how the metadata function is declared and called to fix the issue. Fixes #80538. rdar://148597079
36aaa67
to
b3b2031
Compare
@swift-ci please smoke test |
To trigger this error one needs to import a nested type from C++, use it in a generic context in Swift, and export it back to C++. We were inconsisent in what namespace did we declare the functions to get the type metadata for types. It was in the swift namespace for foreign types and in the module namespace for Swift types. This PR standardizes on how the metadata function is declared and called to fix the issue.
Fixes #80538.
rdar://148597079