Skip to content

Commit 828cb50

Browse files
authored
Merge pull request #12591 from slavapestov/clang-importer-validation-cleanup
ClangImporter: Remove redundant calls to ValueDecl::setValidationStarted()
2 parents 0fa818e + ea5aa0b commit 828cb50

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,7 +2440,6 @@ namespace {
24402440
auto structDecl = Impl.createDeclWithClangNode<StructDecl>(decl,
24412441
AccessLevel::Public, Loc, name, Loc, None, nullptr, dc);
24422442
structDecl->computeType();
2443-
structDecl->setValidationStarted();
24442443
structDecl->setCheckedInheritanceClause();
24452444

24462445
auto options = getDefaultMakeStructRawValuedOptions();
@@ -2544,7 +2543,6 @@ namespace {
25442543
decl, AccessLevel::Public, loc, enumName,
25452544
Impl.importSourceLoc(decl->getLocation()), None, nullptr, enumDC);
25462545
enumDecl->computeType();
2547-
enumDecl->setValidationStarted();
25482546

25492547
// Set up the C underlying type as its Swift raw type.
25502548
enumDecl->setRawType(underlyingType);
@@ -2883,7 +2881,6 @@ namespace {
28832881
Impl.importSourceLoc(decl->getLocation()),
28842882
None, nullptr, dc);
28852883
result->computeType();
2886-
result->setValidationStarted();
28872884
Impl.ImportedDecls[{decl->getCanonicalDecl(), getVersion()}] = result;
28882885

28892886
// FIXME: Figure out what to do with superclasses in C++. One possible
@@ -3203,7 +3200,6 @@ namespace {
32033200
Impl.importSourceLoc(decl->getLocStart()),
32043201
name, dc->mapTypeIntoContext(type), dc);
32053202
result->setInterfaceType(type);
3206-
result->setValidationStarted();
32073203

32083204
// If this is a compatibility stub, mark is as such.
32093205
if (correctSwiftName)
@@ -3427,7 +3423,6 @@ namespace {
34273423
Impl.importSourceLoc(decl->getLocation()),
34283424
name, dc->mapTypeIntoContext(type), dc);
34293425
result->setInterfaceType(type);
3430-
result->setValidationStarted();
34313426

34323427
// Handle attributes.
34333428
if (decl->hasAttr<clang::IBOutletAttr>())
@@ -3507,7 +3502,6 @@ namespace {
35073502
Impl.importSourceLoc(decl->getLocation()),
35083503
name, dc->mapTypeIntoContext(type), dc);
35093504
result->setInterfaceType(type);
3510-
result->setValidationStarted();
35113505

35123506
// If imported as member, the member should be final.
35133507
if (dc->getAsClassOrClassExtensionContext())
@@ -4190,7 +4184,6 @@ namespace {
41904184
Impl.importSourceLoc(decl->getLocation()), name, None,
41914185
/*TrailingWhere=*/nullptr);
41924186
result->computeType();
4193-
result->setValidationStarted();
41944187

41954188
// FIXME: Kind of awkward that we have to do this here
41964189
result->getGenericParams()->getParams()[0]->setDepth(0);
@@ -4253,7 +4246,6 @@ namespace {
42534246
SourceLoc(), None,
42544247
nullptr, dc);
42554248
result->computeType();
4256-
result->setValidationStarted();
42574249
Impl.ImportedDecls[{decl->getCanonicalDecl(), getVersion()}] = result;
42584250
result->setCircularityCheck(CircularityCheck::Checked);
42594251
result->setSuperclass(Type());
@@ -4354,7 +4346,6 @@ namespace {
43544346
}
43554347

43564348
result->computeType();
4357-
result->setValidationStarted();
43584349

43594350
Impl.ImportedDecls[{decl->getCanonicalDecl(), getVersion()}] = result;
43604351
result->setCircularityCheck(CircularityCheck::Checked);
@@ -4595,7 +4586,6 @@ namespace {
45954586
/*IsCaptureList*/false, Impl.importSourceLoc(decl->getLocation()),
45964587
name, dc->mapTypeIntoContext(type), dc);
45974588
result->setInterfaceType(type);
4598-
result->setValidationStarted();
45994589

46004590
// Turn this into a computed property.
46014591
// FIXME: Fake locations for '{' and '}'?
@@ -4812,7 +4802,6 @@ SwiftDeclConverter::importCFClassType(const clang::TypedefNameDecl *decl,
48124802
decl, AccessLevel::Public, SourceLoc(), className, SourceLoc(), None,
48134803
nullptr, dc);
48144804
theClass->computeType();
4815-
theClass->setValidationStarted();
48164805
theClass->setCircularityCheck(CircularityCheck::Checked);
48174806
theClass->setSuperclass(superclass);
48184807
theClass->setAddedImplicitInitializers(); // suppress all initializers
@@ -4988,7 +4977,6 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
49884977
auto structDecl = Impl.createDeclWithClangNode<StructDecl>(
49894978
decl, AccessLevel::Public, Loc, name, Loc, None, nullptr, dc);
49904979
structDecl->computeType();
4991-
structDecl->setValidationStarted();
49924980
structDecl->setCheckedInheritanceClause();
49934981

49944982
// Import the type of the underlying storage
@@ -5146,7 +5134,6 @@ Decl *SwiftDeclConverter::importEnumCase(const clang::EnumConstantDecl *decl,
51465134

51475135
// Give the enum element the appropriate type.
51485136
element->computeType();
5149-
element->setValidationStarted();
51505137

51515138
Impl.importAttributes(decl, element);
51525139

@@ -5238,7 +5225,6 @@ SwiftDeclConverter::importAsOptionSetType(DeclContext *dc, Identifier name,
52385225
auto structDecl = Impl.createDeclWithClangNode<StructDecl>(
52395226
decl, AccessLevel::Public, Loc, name, Loc, None, nullptr, dc);
52405227
structDecl->computeType();
5241-
structDecl->setValidationStarted();
52425228
structDecl->setCheckedInheritanceClause();
52435229

52445230
makeStructRawValued(Impl, structDecl, underlyingType,
@@ -5320,7 +5306,6 @@ Decl *SwiftDeclConverter::importGlobalAsInitializer(
53205306
Type selfMetaType = MetatypeType::get(selfType->getInOutObjectType());
53215307
Type allocType = FunctionType::get(selfMetaType, fnType);
53225308
result->setInterfaceType(allocType);
5323-
result->setValidationStarted();
53245309

53255310
finishFuncDecl(decl, result);
53265311
if (correctSwiftName)
@@ -5561,7 +5546,6 @@ SwiftDeclConverter::getImplicitProperty(ImportedName importedName,
55615546
VarDecl::Specifier::Var, /*IsCaptureList*/false, SourceLoc(),
55625547
propertyName, dc->mapTypeIntoContext(swiftPropertyType), dc);
55635548
property->setInterfaceType(swiftPropertyType);
5564-
property->setValidationStarted();
55655549

55665550
// Note that we've formed this property.
55675551
Impl.FunctionsAsProperties[getter] = property;
@@ -5937,7 +5921,6 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
59375921
result->setInitializerInterfaceType(interfaceInitType);
59385922
result->setInterfaceType(interfaceAllocType);
59395923
result->setGenericEnvironment(dc->getGenericEnvironmentOfContext());
5940-
result->setValidationStarted();
59415924

59425925
if (implicit)
59435926
result->setImplicit();
@@ -6335,7 +6318,6 @@ SwiftDeclConverter::importSubscript(Decl *decl,
63356318
else
63366319
fnType = FunctionType::get(indicesType, elementTy);
63376320
subscript->setInterfaceType(fnType);
6338-
subscript->setValidationStarted();
63396321

63406322
addObjCAttribute(subscript, None);
63416323

@@ -7897,10 +7879,10 @@ ClangImporter::Implementation::createConstant(Identifier name, DeclContext *dc,
78977879
var = new (SwiftContext)
78987880
VarDecl(/*IsStatic*/isStatic, VarDecl::Specifier::Var, /*IsCaptureList*/false,
78997881
SourceLoc(), name, dc->mapTypeIntoContext(type), dc);
7882+
var->setValidationStarted();
79007883
}
79017884

79027885
var->setInterfaceType(type);
7903-
var->setValidationStarted();
79047886

79057887
// Form the argument patterns.
79067888
SmallVector<ParameterList*, 3> getterArgs;
@@ -8008,7 +7990,6 @@ createUnavailableDecl(Identifier name, DeclContext *dc, Type type,
80087990
/*IsCaptureList*/false,
80097991
SourceLoc(), name, type, dc);
80107992
var->setInterfaceType(type);
8011-
var->setValidationStarted();
80127993
markUnavailable(var, UnavailableMessage);
80137994

80147995
return var;

0 commit comments

Comments
 (0)