Skip to content

Commit c310abd

Browse files
committed
add -emit-ast and -emit-parse as aliases for the -dump-* flags
This is mainly to improve usability for Swift compiler developers. resolves rdar://99357128
1 parent 04f1cde commit c310abd

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,9 +1061,13 @@ def typecheck : Flag<["-"], "typecheck">,
10611061
def dump_parse : Flag<["-"], "dump-parse">,
10621062
HelpText<"Parse input file(s) and dump AST(s)">, ModeOpt,
10631063
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
1064+
def emit_parse : Flag<["-"], "emit-parse">, Alias<dump_parse>,
1065+
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
10641066
def dump_ast : Flag<["-"], "dump-ast">,
10651067
HelpText<"Parse and type-check input file(s) and dump AST(s)">, ModeOpt,
10661068
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
1069+
def emit_ast : Flag<["-"], "emit-ast">, Alias<dump_ast>,
1070+
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
10671071
def dump_scope_maps : Separate<["-"], "dump-scope-maps">,
10681072
HelpText<"Parse and type-check input file(s) and dump the scope map(s)">,
10691073
MetaVarName<"<expanded-or-list-of-line:column>">,

test/Frontend/ast-dump.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// RUN: echo 'public func b() { }' >%t/b.swift
44
// RUN: echo 'public func main() {a(); b()}' >%t/main.swift
55

6-
// Test printing to stdout
6+
// Test printing to stdout (using either -dump-ast or -emit-ast)
77
// RUN: %target-swift-frontend -dump-ast -primary-file %t/a.swift %t/b.swift %t/main.swift -module-name main -o - 2>%t/a.swift.stderr | %FileCheck -check-prefix A-AST %s
8-
// RUN: %target-swift-frontend -dump-ast %t/a.swift -primary-file %t/b.swift %t/main.swift -module-name main -o - 2>%t/b.swift.stderr | %FileCheck -check-prefix B-AST %s
8+
// RUN: %target-swift-frontend -emit-ast %t/a.swift -primary-file %t/b.swift %t/main.swift -module-name main -o - 2>%t/b.swift.stderr | %FileCheck -check-prefix B-AST %s
99
// RUN: %target-swift-frontend -dump-ast %t/a.swift %t/b.swift -primary-file %t/main.swift -module-name main -o - 2>%t/main.swift.stderr | %FileCheck -check-prefix MAIN-AST %s
1010

1111
// Test printing to files

test/Frontend/dump-parse-syntactically-valid.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// RUN: %target-swift-frontend -emit-parse %s
12
// RUN: %target-swift-frontend -dump-parse %s
23

4+
// Also makes sure -emit-parse and -dump-parse are both valid.
5+
36
// Make sure we don't do any Sema and don't crash.
47
extension X {
58
typealias Y = Z

0 commit comments

Comments
 (0)