mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -2284,10 +2284,6 @@ bool ShouldPrintChecker::shouldPrint(const Decl *D,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isa<IfConfigDecl>(D)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3373,10 +3369,6 @@ void PrintAST::visitTopLevelCodeDecl(TopLevelCodeDecl *decl) {
|
||||
printASTNodes(decl->getBody()->getElements(), /*NeedIndent=*/false);
|
||||
}
|
||||
|
||||
void PrintAST::visitIfConfigDecl(IfConfigDecl *ICD) {
|
||||
// Never printed
|
||||
}
|
||||
|
||||
void PrintAST::visitPoundDiagnosticDecl(PoundDiagnosticDecl *PDD) {
|
||||
/// TODO: Should we even print #error/#warning?
|
||||
if (PDD->isError()) {
|
||||
@@ -5533,8 +5525,6 @@ void PrintAST::visitSwitchStmt(SwitchStmt *stmt) {
|
||||
for (auto N : stmt->getRawCases()) {
|
||||
if (N.is<Stmt*>())
|
||||
visit(cast<CaseStmt>(N.get<Stmt*>()));
|
||||
else
|
||||
visit(cast<IfConfigDecl>(N.get<Decl*>()));
|
||||
Printer.printNewline();
|
||||
}
|
||||
indent();
|
||||
@@ -5633,10 +5623,6 @@ bool Decl::shouldPrintInContext(const PrintOptions &PO) const {
|
||||
}
|
||||
}
|
||||
|
||||
if (isa<IfConfigDecl>(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Print everything else.
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user