mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ASTPrinter] Print expressions
Add new `-print-ast-decl` frontend option for only printing declarations, to match existing behavior. Some tests want to print the AST, but don't care about expressions. The existing `-print-ast` option now prints function bodies and expressions. Not all expressions are printed yet, but most common ones are.
This commit is contained in:
@@ -1197,6 +1197,13 @@ static bool performAction(CompilerInstance &Instance,
|
||||
llvm::outs(), PrintOptions::printEverything());
|
||||
return Instance.getASTContext().hadError();
|
||||
});
|
||||
case FrontendOptions::ActionType::PrintASTDecl:
|
||||
return withSemanticAnalysis(
|
||||
Instance, observer, [](CompilerInstance &Instance) {
|
||||
getPrimaryOrMainSourceFile(Instance).print(
|
||||
llvm::outs(), PrintOptions::printDeclarations());
|
||||
return Instance.getASTContext().hadError();
|
||||
});
|
||||
case FrontendOptions::ActionType::DumpScopeMaps:
|
||||
return withSemanticAnalysis(
|
||||
Instance, observer, [](CompilerInstance &Instance) {
|
||||
|
||||
Reference in New Issue
Block a user