AST: New ASTContext::addSynthesizedDecl() method

This adds the declaration to the external declarations list only
if it was part of an imported declaration, eliminating some
boilerplate.
This commit is contained in:
Slava Pestov
2018-04-01 23:09:11 -07:00
parent 911d201d51
commit 3bcdf1a027
8 changed files with 22 additions and 57 deletions

View File

@@ -183,11 +183,7 @@ static ValueDecl *deriveInitDecl(TypeChecker &tc, Decl *parentDecl,
initDecl->setAccess(enumDecl->getFormalAccess());
initDecl->setValidationStarted();
// If the enum was not imported, the derived conformance is either from the
// enum itself or an extension, in which case we will emit the declaration
// normally.
if (enumDecl->hasClangNode())
tc.Context.addExternalDecl(initDecl);
tc.Context.addSynthesizedDecl(initDecl);
cast<IterableDeclContext>(parentDecl)->addMember(initDecl);
return initDecl;