Skip to content

Commit ff768b9

Browse files
committed
[ClangImporter] Mark some synthesized Clang decls implicit
I was hoping this would be enough to avoid the crash in rdar://82820628, as we shouldn't emit coverage mappings for synthesized Clang decls, but it seems it can still cause Clang to crash (rdar://100172217). Regardless, it seems like these should be implicit anyway, so mark them as such.
1 parent 7054460 commit ff768b9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ClangImporter/SwiftDeclSynthesizer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ std::pair<FuncDecl *, FuncDecl *> SwiftDeclSynthesizer::makeBitFieldAccessors(
981981
Ctx, structDecl->getDeclContext(), clang::SourceLocation(),
982982
clang::SourceLocation(), cGetterName, cGetterType, cGetterTypeInfo,
983983
clang::SC_Static);
984+
cGetterDecl->setImplicit();
984985
cGetterDecl->setImplicitlyInline();
985986
assert(!cGetterDecl->isExternallyVisible());
986987

@@ -1002,6 +1003,7 @@ std::pair<FuncDecl *, FuncDecl *> SwiftDeclSynthesizer::makeBitFieldAccessors(
10021003
Ctx, structDecl->getDeclContext(), clang::SourceLocation(),
10031004
clang::SourceLocation(), cSetterName, cSetterType, cSetterTypeInfo,
10041005
clang::SC_Static);
1006+
cSetterDecl->setImplicit();
10051007
cSetterDecl->setImplicitlyInline();
10061008
assert(!cSetterDecl->isExternallyVisible());
10071009

@@ -1017,6 +1019,7 @@ std::pair<FuncDecl *, FuncDecl *> SwiftDeclSynthesizer::makeBitFieldAccessors(
10171019
auto cGetterSelf = clang::ParmVarDecl::Create(
10181020
Ctx, cGetterDecl, clang::SourceLocation(), clang::SourceLocation(),
10191021
cGetterSelfId, recordType, recordTypeInfo, clang::SC_None, nullptr);
1022+
cGetterSelf->setImplicit();
10201023
cGetterDecl->setParams(cGetterSelf);
10211024

10221025
auto cGetterSelfExpr = new (Ctx)
@@ -1040,13 +1043,15 @@ std::pair<FuncDecl *, FuncDecl *> SwiftDeclSynthesizer::makeBitFieldAccessors(
10401043
Ctx, cSetterDecl, clang::SourceLocation(), clang::SourceLocation(),
10411044
/* nameID? */ nullptr, fieldType, fieldTypeInfo, clang::SC_None,
10421045
nullptr);
1046+
cSetterValue->setImplicit();
10431047
cSetterParams.push_back(cSetterValue);
10441048
auto recordPointerTypeInfo =
10451049
Ctx.getTrivialTypeSourceInfo(recordPointerType);
10461050
auto cSetterSelf = clang::ParmVarDecl::Create(
10471051
Ctx, cSetterDecl, clang::SourceLocation(), clang::SourceLocation(),
10481052
/* nameID? */ nullptr, recordPointerType, recordPointerTypeInfo,
10491053
clang::SC_None, nullptr);
1054+
cSetterSelf->setImplicit();
10501055
cSetterParams.push_back(cSetterSelf);
10511056
cSetterDecl->setParams(cSetterParams);
10521057

0 commit comments

Comments
 (0)