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

@@ -2027,7 +2027,6 @@ static bool shouldSerializeMember(Decl *D) {
case DeclKind::BuiltinTuple:
llvm_unreachable("BuiltinTupleDecl should not show up here");
case DeclKind::IfConfig:
case DeclKind::PoundDiagnostic:
return false;
@@ -5061,10 +5060,6 @@ public:
llvm_unreachable("import decls should not be serialized");
}
void visitIfConfigDecl(const IfConfigDecl *) {
llvm_unreachable("#if block declarations should not be serialized");
}
void visitPoundDiagnosticDecl(const PoundDiagnosticDecl *) {
llvm_unreachable("#warning/#error declarations should not be serialized");
}
@@ -6713,9 +6708,8 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
nextFile->getTopLevelDeclsWithAuxiliaryDecls(fileDecls);
for (auto D : fileDecls) {
if (isa<ImportDecl>(D) || isa<IfConfigDecl>(D) ||
isa<PoundDiagnosticDecl>(D) || isa<TopLevelCodeDecl>(D) ||
isa<MacroExpansionDecl>(D)) {
if (isa<ImportDecl>(D) || isa<MacroExpansionDecl>(D) ||
isa<PoundDiagnosticDecl>(D) || isa<TopLevelCodeDecl>(D)) {
continue;
}