File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
include/swift/ClangImporter Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ SourceLoc extractNearestSourceLoc(CxxRecordSemanticsDescriptor desc);
353353// /
354354// / Do not evaluate this request before importing has started. For example, it
355355// / is OK to invoke this request when importing a decl, but it is not OK to
356- // / import this request when importing names. This is because when importing
356+ // / evaluate this request when importing names. This is because when importing
357357// / names, Clang sema has not yet defined implicit special members, so the
358358// / results will be flakey/incorrect.
359359class CxxRecordSemantics
Original file line number Diff line number Diff line change @@ -157,14 +157,10 @@ bool ClangImporter::Implementation::recordHasReferenceSemantics(
157157 if (!isa<clang::CXXRecordDecl>(decl) && !ctx.LangOpts .CForeignReferenceTypes )
158158 return false ;
159159
160- return decl->hasAttrs () && llvm::any_of (decl->getAttrs (), [](auto *attr) {
161- if (auto swiftAttr = dyn_cast<clang::SwiftAttrAttr>(attr))
162- return swiftAttr->getAttribute () == " import_reference" ||
163- // TODO: Remove this once libSwift hosttools no longer
164- // requires it.
165- swiftAttr->getAttribute () == " import_as_ref" ;
166- return false ;
167- });
160+ auto semanticsKind =
161+ evaluateOrDefault (ctx.evaluator ,
162+ CxxRecordSemantics ({decl, ctx}), {});
163+ return semanticsKind == CxxRecordSemanticsKind::Reference;
168164}
169165
170166#ifndef NDEBUG
You can’t perform that action at this time.
0 commit comments