Skip to content

Commit 7782851

Browse files
committed
[AST] TypeWrappers/NFC: Move local $storage handling code to TypeWrapper.cpp
1 parent a8d8cf0 commit 7782851

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

lib/AST/Decl.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6598,14 +6598,6 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
65986598
return true;
65996599
}
66006600

6601-
bool VarDecl::isTypeWrapperLocalStorageForInitializer() const {
6602-
if (auto *ctor =
6603-
dyn_cast_or_null<ConstructorDecl>(getDeclContext()->getAsDecl())) {
6604-
return this == ctor->getLocalTypeWrapperStorageVar();
6605-
}
6606-
return false;
6607-
}
6608-
66096601
bool VarDecl::isLet() const {
66106602
// An awful hack that stabilizes the value of 'isLet' for ParamDecl instances.
66116603
//
@@ -8890,14 +8882,6 @@ bool ConstructorDecl::isObjCZeroParameterWithLongSelector() const {
88908882
return params->get(0)->getInterfaceType()->isVoid();
88918883
}
88928884

8893-
VarDecl *ConstructorDecl::getLocalTypeWrapperStorageVar() const {
8894-
auto &ctx = getASTContext();
8895-
auto *mutableSelf = const_cast<ConstructorDecl *>(this);
8896-
return evaluateOrDefault(
8897-
ctx.evaluator, SynthesizeLocalVariableForTypeWrapperStorage{mutableSelf},
8898-
nullptr);
8899-
}
8900-
89018885
DestructorDecl::DestructorDecl(SourceLoc DestructorLoc, DeclContext *Parent)
89028886
: AbstractFunctionDecl(DeclKind::Destructor, Parent,
89038887
DeclBaseName::createDestructor(), DestructorLoc,

lib/AST/TypeWrapper.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ NominalTypeDecl *NominalTypeDecl::getTypeWrapper() const {
2727
GetTypeWrapper{mutableSelf}, nullptr);
2828
}
2929

30+
VarDecl *ConstructorDecl::getLocalTypeWrapperStorageVar() const {
31+
auto &ctx = getASTContext();
32+
auto *mutableSelf = const_cast<ConstructorDecl *>(this);
33+
return evaluateOrDefault(
34+
ctx.evaluator, SynthesizeLocalVariableForTypeWrapperStorage{mutableSelf},
35+
nullptr);
36+
}
37+
38+
bool VarDecl::isTypeWrapperLocalStorageForInitializer() const {
39+
if (auto *ctor =
40+
dyn_cast_or_null<ConstructorDecl>(getDeclContext()->getAsDecl())) {
41+
return this == ctor->getLocalTypeWrapperStorageVar();
42+
}
43+
return false;
44+
}
45+
3046
bool UsesTypeWrapperFeature::evaluate(Evaluator &evaluator,
3147
NominalTypeDecl *decl) const {
3248
// This is a type wrapper type.

0 commit comments

Comments
 (0)