Skip to content

Commit 615062d

Browse files
committed
[cxx-interop] Fix warning; pull apart another case where record semantics relied on sema having instanciated special members.
1 parent 9ee2667 commit 615062d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,10 +1960,14 @@ namespace {
19601960
!Impl.SwiftContext.LangOpts.CForeignReferenceTypes)
19611961
return false;
19621962

1963-
auto semanticsKind = evaluateOrDefault(
1964-
Impl.SwiftContext.evaluator,
1965-
CxxRecordSemantics({decl, Impl.SwiftContext}), {});
1966-
return semanticsKind == CxxRecordSemanticsKind::Reference;
1963+
return decl->hasAttrs() && llvm::any_of(decl->getAttrs(), [](auto *attr) {
1964+
if (auto swiftAttr = dyn_cast<clang::SwiftAttrAttr>(attr))
1965+
return swiftAttr->getAttribute() == "import_reference" ||
1966+
// TODO: Remove this once libSwift hosttools no longer
1967+
// requires it.
1968+
swiftAttr->getAttribute() == "import_as_ref";
1969+
return false;
1970+
});
19671971
}
19681972

19691973
bool recordHasMoveOnlySemantics(const clang::RecordDecl *decl) {

0 commit comments

Comments
 (0)