Merge pull request #16655 from davezarzycki/formalize_DeclIsBeingValidatedRAII

[AST] NFC: Formalize Decl validation tracking via RAII
This commit is contained in:
Slava Pestov
2018-07-17 14:07:53 -07:00
committed by GitHub
14 changed files with 173 additions and 136 deletions

View File

@@ -2123,7 +2123,11 @@ void ValueDecl::setInterfaceType(Type type) {
}
bool ValueDecl::hasValidSignature() const {
return hasInterfaceType() && !isBeingValidated();
if (!hasInterfaceType())
return false;
// FIXME -- The build blows up if the correct code is used:
// return getValidationState() > ValidationState::CheckingWithValidSignature;
return getValidationState() != ValidationState::Checking;
}
Optional<ObjCSelector> ValueDecl::getObjCRuntimeName() const {
@@ -2727,7 +2731,7 @@ SourceRange TypeAliasDecl::getSourceRange() const {
}
void TypeAliasDecl::setUnderlyingType(Type underlying) {
setValidationStarted();
setValidationToChecked();
// lldb creates global typealiases containing archetypes
// sometimes...
@@ -2945,7 +2949,7 @@ void ClassDecl::addImplicitDestructor() {
auto *DD = new (ctx) DestructorDecl(getLoc(), selfDecl, this);
DD->setImplicit();
DD->setValidationStarted();
DD->setValidationToChecked();
// Create an empty body for the destructor.
DD->setBody(BraceStmt::create(ctx, getLoc(), { }, getLoc(), true));
@@ -4527,7 +4531,7 @@ ParamDecl *ParamDecl::createSelf(SourceLoc loc, DeclContext *DC,
Identifier(), loc, C.Id_self, Type(), DC);
selfDecl->setImplicit();
selfDecl->setInterfaceType(selfInterfaceType);
selfDecl->setValidationStarted();
selfDecl->setValidationToChecked();
return selfDecl;
}