Remove IfConfigDecl from the AST

The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
This commit is contained in:
Doug Gregor
2024-09-18 20:46:57 -07:00
parent d762dd53f8
commit 5b2520e379
38 changed files with 16 additions and 476 deletions

View File

@@ -157,7 +157,6 @@ DescriptiveDeclKind Decl::getDescriptiveKind() const {
TRIVIAL_KIND(Extension);
TRIVIAL_KIND(EnumCase);
TRIVIAL_KIND(TopLevelCode);
TRIVIAL_KIND(IfConfig);
TRIVIAL_KIND(PoundDiagnostic);
TRIVIAL_KIND(PatternBinding);
TRIVIAL_KIND(PrecedenceGroup);
@@ -323,7 +322,6 @@ StringRef Decl::getDescriptiveKindName(DescriptiveDeclKind K) {
ENTRY(Extension, "extension");
ENTRY(EnumCase, "case");
ENTRY(TopLevelCode, "top-level code");
ENTRY(IfConfig, "conditional block");
ENTRY(PoundDiagnostic, "diagnostic");
ENTRY(PatternBinding, "pattern binding");
ENTRY(Var, "var");
@@ -1444,7 +1442,6 @@ ImportKind ImportDecl::getBestImportKind(const ValueDecl *VD) {
case DeclKind::PrefixOperator:
case DeclKind::PostfixOperator:
case DeclKind::EnumCase:
case DeclKind::IfConfig:
case DeclKind::PoundDiagnostic:
case DeclKind::PrecedenceGroup:
case DeclKind::Missing:
@@ -2532,10 +2529,6 @@ SourceRange TopLevelCodeDecl::getSourceRange() const {
return Body? Body->getSourceRange() : SourceRange();
}
SourceRange IfConfigDecl::getSourceRange() const {
return SourceRange(getLoc(), EndLoc);
}
static bool isPolymorphic(const AbstractStorageDecl *storage) {
if (storage->shouldUseObjCDispatch())
return true;
@@ -3178,7 +3171,6 @@ bool ValueDecl::isInstanceMember() const {
case DeclKind::InfixOperator:
case DeclKind::PrefixOperator:
case DeclKind::PostfixOperator:
case DeclKind::IfConfig:
case DeclKind::PoundDiagnostic:
case DeclKind::PrecedenceGroup:
case DeclKind::Missing:
@@ -4102,7 +4094,6 @@ SourceLoc Decl::getAttributeInsertionLoc(bool forModifier) const {
switch (getKind()) {
case DeclKind::Module:
case DeclKind::TopLevelCode:
case DeclKind::IfConfig:
case DeclKind::PoundDiagnostic:
case DeclKind::Missing:
case DeclKind::MissingMember: