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);
353
353
// /
354
354
// / Do not evaluate this request before importing has started. For example, it
355
355
// / 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
357
357
// / names, Clang sema has not yet defined implicit special members, so the
358
358
// / results will be flakey/incorrect.
359
359
class CxxRecordSemantics
Original file line number Diff line number Diff line change @@ -156,14 +156,10 @@ bool ClangImporter::Implementation::recordHasReferenceSemantics(
156
156
if (!isa<clang::CXXRecordDecl>(decl) && !ctx.LangOpts .CForeignReferenceTypes )
157
157
return false ;
158
158
159
- return decl->hasAttrs () && llvm::any_of (decl->getAttrs (), [](auto *attr) {
160
- if (auto swiftAttr = dyn_cast<clang::SwiftAttrAttr>(attr))
161
- return swiftAttr->getAttribute () == " import_reference" ||
162
- // TODO: Remove this once libSwift hosttools no longer
163
- // requires it.
164
- swiftAttr->getAttribute () == " import_as_ref" ;
165
- return false ;
166
- });
159
+ auto semanticsKind =
160
+ evaluateOrDefault (ctx.evaluator ,
161
+ CxxRecordSemantics ({decl, ctx}), {});
162
+ return semanticsKind == CxxRecordSemanticsKind::Reference;
167
163
}
168
164
169
165
#ifndef NDEBUG
You can’t perform that action at this time.
0 commit comments