Skip to content

Commit d3547fd

Browse files
authored
Merge pull request #20392 from vinivendra/ast-dump-to-files
Add option to dump AST to files
2 parents 3f4b742 + 318e7be commit d3547fd

30 files changed

+150
-54
lines changed

include/swift/Basic/FileTypes.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ TYPE("sil", SIL, "sil", "")
4141
TYPE("sib", SIB, "sib", "")
4242

4343
// Output types
44+
TYPE("ast-dump", ASTDump, "ast", "")
4445
TYPE("image", Image, "out", "")
4546
TYPE("object", Object, "o", "")
4647
TYPE("dSYM", dSYM, "dSYM", "")

include/swift/Basic/PrimarySpecificPaths.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ namespace swift {
2727
class PrimarySpecificPaths {
2828
public:
2929
/// The name of the main output file,
30-
/// that is, the .o file for this input. If there is no such file, contains an
31-
/// empty string. If the output is to be written to stdout, contains "-".
30+
/// that is, the .o file for this input (or a file specified by -o).
31+
/// If there is no such file, contains an empty string. If the output
32+
/// is to be written to stdout, contains "-".
3233
std::string OutputFilename;
3334

3435
SupplementaryOutputPaths SupplementaryOutputs;

lib/AST/ASTDumper.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ namespace {
8585
PrintWithColorRAII(raw_ostream &os, TerminalColor color)
8686
: OS(os), ShowColors(false)
8787
{
88-
if (&os == &llvm::errs() || &os == &llvm::outs())
89-
ShowColors = llvm::errs().has_colors() && llvm::outs().has_colors();
88+
ShowColors = os.has_colors();
9089

9190
if (ShowColors)
9291
OS.changeColor(color.Color, color.Bold);
@@ -417,13 +416,9 @@ namespace {
417416
public:
418417
raw_ostream &OS;
419418
unsigned Indent;
420-
bool ShowColors;
421419

422420
explicit PrintPattern(raw_ostream &os, unsigned indent = 0)
423-
: OS(os), Indent(indent), ShowColors(false) {
424-
if (&os == &llvm::errs() || &os == &llvm::outs())
425-
ShowColors = llvm::errs().has_colors() && llvm::outs().has_colors();
426-
}
421+
: OS(os), Indent(indent) { }
427422

428423
void printRec(Decl *D) { D->dump(OS, Indent + 2); }
429424
void printRec(Expr *E) { E->dump(OS, Indent + 2); }
@@ -545,13 +540,9 @@ namespace {
545540
public:
546541
raw_ostream &OS;
547542
unsigned Indent;
548-
bool ShowColors;
549543

550544
explicit PrintDecl(raw_ostream &os, unsigned indent = 0)
551-
: OS(os), Indent(indent), ShowColors(false) {
552-
if (&os == &llvm::errs() || &os == &llvm::outs())
553-
ShowColors = llvm::errs().has_colors() && llvm::outs().has_colors();
554-
}
545+
: OS(os), Indent(indent) { }
555546

556547
void printRec(Decl *D) { PrintDecl(OS, Indent + 2).visit(D); }
557548
void printRec(Expr *E) { E->dump(OS, Indent+2); }
@@ -2713,13 +2704,9 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> {
27132704
public:
27142705
raw_ostream &OS;
27152706
unsigned Indent;
2716-
bool ShowColors;
27172707

27182708
PrintTypeRepr(raw_ostream &os, unsigned indent)
2719-
: OS(os), Indent(indent), ShowColors(false) {
2720-
if (&os == &llvm::errs() || &os == &llvm::outs())
2721-
ShowColors = llvm::errs().has_colors() && llvm::outs().has_colors();
2722-
}
2709+
: OS(os), Indent(indent) { }
27232710

27242711
void printRec(Decl *D) { D->dump(OS, Indent + 2); }
27252712
void printRec(Expr *E) { E->dump(OS, Indent + 2); }

lib/Basic/FileTypes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ bool file_types::isTextual(ID Id) {
7070
case file_types::TY_SIL:
7171
case file_types::TY_Dependencies:
7272
case file_types::TY_Assembly:
73+
case file_types::TY_ASTDump:
7374
case file_types::TY_RawSIL:
7475
case file_types::TY_LLVM_IR:
7576
case file_types::TY_ObjCHeader:
@@ -117,6 +118,7 @@ bool file_types::isAfterLLVM(ID Id) {
117118
case file_types::TY_TBD:
118119
case file_types::TY_SIL:
119120
case file_types::TY_Dependencies:
121+
case file_types::TY_ASTDump:
120122
case file_types::TY_RawSIL:
121123
case file_types::TY_ObjCHeader:
122124
case file_types::TY_AutolinkFile:
@@ -171,6 +173,7 @@ bool file_types::isPartOfSwiftCompilation(ID Id) {
171173
case file_types::TY_ClangModuleFile:
172174
case file_types::TY_SwiftDeps:
173175
case file_types::TY_Nothing:
176+
case file_types::TY_ASTDump:
174177
case file_types::TY_Remapping:
175178
case file_types::TY_IndexData:
176179
case file_types::TY_ModuleTrace:

lib/Driver/Driver.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,10 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
13891389
OI.CompilerOutputType = file_types::TY_LLVM_BC;
13901390
break;
13911391

1392+
case options::OPT_dump_ast:
1393+
OI.CompilerOutputType = file_types::TY_ASTDump;
1394+
break;
1395+
13921396
case options::OPT_emit_pch:
13931397
OI.CompilerMode = OutputInfo::Mode::SingleCompile;
13941398
OI.CompilerOutputType = file_types::TY_PCH;
@@ -1411,11 +1415,11 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
14111415
OI.CompilerOutputType = file_types::TY_Remapping;
14121416
OI.LinkAction = LinkKind::None;
14131417
break;
1418+
14141419
case options::OPT_parse:
14151420
case options::OPT_resolve_imports:
14161421
case options::OPT_typecheck:
14171422
case options::OPT_dump_parse:
1418-
case options::OPT_dump_ast:
14191423
case options::OPT_emit_syntax:
14201424
case options::OPT_print_ast:
14211425
case options::OPT_dump_type_refinement_contexts:
@@ -1764,6 +1768,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
17641768
break;
17651769
}
17661770
LLVM_FALLTHROUGH;
1771+
case file_types::TY_ASTDump:
17671772
case file_types::TY_Image:
17681773
case file_types::TY_dSYM:
17691774
case file_types::TY_Dependencies:

lib/Driver/ToolChains.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ const char *ToolChain::JobContext::computeFrontendModeForCompile() const {
397397
return "-c";
398398
case file_types::TY_PCH:
399399
return "-emit-pch";
400+
case file_types::TY_ASTDump:
401+
return "-dump-ast";
400402
case file_types::TY_RawSIL:
401403
return "-emit-silgen";
402404
case file_types::TY_SIL:
@@ -652,6 +654,7 @@ ToolChain::constructInvocation(const BackendJobAction &job,
652654
case file_types::TY_ImportedModules:
653655
case file_types::TY_TBD:
654656
case file_types::TY_SwiftModuleFile:
657+
case file_types::TY_ASTDump:
655658
case file_types::TY_RawSIL:
656659
case file_types::TY_RawSIB:
657660
case file_types::TY_SIL:

lib/FrontendTool/FrontendTool.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,29 @@ static SourceFile *getPrimaryOrMainSourceFile(CompilerInvocation &Invocation,
685685
return SF;
686686
}
687687

688+
/// Dumps the AST of all available primary source files. If corresponding output
689+
/// files were specified, use them; otherwise, dump the AST to stdout.
690+
static void dumpAST(CompilerInvocation &Invocation,
691+
CompilerInstance &Instance) {
692+
// FIXME: WMO doesn't use the notion of primary files, so this doesn't do the
693+
// right thing. Perhaps it'd be best to ignore WMO when dumping the AST, just
694+
// like WMO ignores `-incremental`.
695+
696+
auto primaryFiles = Instance.getPrimarySourceFiles();
697+
if (!primaryFiles.empty()) {
698+
for (SourceFile *sourceFile: primaryFiles) {
699+
auto PSPs = Instance.getPrimarySpecificPathsForSourceFile(*sourceFile);
700+
auto OutputFilename = PSPs.OutputFilename;
701+
auto OS = getFileOutputStream(OutputFilename, Instance.getASTContext());
702+
sourceFile->dump(*OS);
703+
}
704+
} else {
705+
// Some invocations don't have primary files. In that case, we default to
706+
// looking for the main file and dumping it to `stdout`.
707+
getPrimaryOrMainSourceFile(Invocation, Instance)->dump(llvm::outs());
708+
}
709+
}
710+
688711
/// We may have been told to dump the AST (either after parsing or
689712
/// type-checking, which is already differentiated in
690713
/// CompilerInstance::performSema()), so dump or print the main source file and
@@ -728,7 +751,7 @@ static Optional<bool> dumpASTIfNeeded(CompilerInvocation &Invocation,
728751

729752
case FrontendOptions::ActionType::DumpParse:
730753
case FrontendOptions::ActionType::DumpAST:
731-
getPrimaryOrMainSourceFile(Invocation, Instance)->dump();
754+
dumpAST(Invocation, Instance);
732755
break;
733756

734757
case FrontendOptions::ActionType::EmitImportedModules:

test/Driver/actions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
// BASICC: 0: input, "{{.*}}actions.swift", swift
1212
// BASICC: 1: compile, {0}, object
1313

14+
// RUN: %swiftc_driver -driver-print-actions -dump-ast %s 2>&1 | %FileCheck %s -check-prefix=BASICAST
15+
// BASICAST: 0: input, "{{.*}}actions.swift", swift
16+
// BASICAST: 1: compile, {0}, ast-dump
17+
1418
// RUN: %swiftc_driver -driver-print-actions -emit-sil %s 2>&1 | %FileCheck %s -check-prefix=BASICSIL
1519
// BASICSIL: 0: input, "{{.*}}actions.swift", swift
1620
// BASICSIL: 1: compile, {0}, sil

test/Driver/driver-compile.swift

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
// RUN: %FileCheck %s < %t.complex.txt
88
// RUN: %FileCheck -check-prefix COMPLEX %s < %t.complex.txt
99

10+
// RUN: %swiftc_driver -driver-print-jobs -dump-ast -target x86_64-apple-macosx10.9 %s 2>&1 > %t.ast.txt
11+
// RUN: %FileCheck %s < %t.ast.txt
12+
// RUN: %FileCheck -check-prefix AST-STDOUT %s < %t.ast.txt
13+
14+
// RUN: %swiftc_driver -driver-print-jobs -dump-ast -target x86_64-apple-macosx10.9 %s -o output.ast > %t.ast.txt
15+
// RUN: %FileCheck %s < %t.ast.txt
16+
// RUN: %FileCheck -check-prefix AST-O %s < %t.ast.txt
17+
1018
// RUN: %swiftc_driver -driver-print-jobs -emit-silgen -target x86_64-apple-macosx10.9 %s 2>&1 > %t.silgen.txt
1119
// RUN: %FileCheck %s < %t.silgen.txt
1220
// RUN: %FileCheck -check-prefix SILGEN %s < %t.silgen.txt
@@ -74,6 +82,14 @@
7482
// COMPLEX: -o {{.+}}.o
7583

7684

85+
// AST-STDOUT: bin/swift
86+
// AST-STDOUT: -dump-ast
87+
// AST-STDOUT: -o -
88+
89+
// AST-O: bin/swift
90+
// AST-O: -dump-ast
91+
// AST-O: -o output.ast
92+
7793
// SILGEN: bin/swift
7894
// SILGEN: -emit-silgen
7995
// SILGEN: -o -
@@ -102,14 +118,14 @@
102118
// DUPLICATE-NAME: note: filenames are used to distinguish private declarations with the same name
103119

104120
// FILELIST: bin/swift
105-
// FILELIST: -filelist [[SOURCES:(["][^"]+|[^ ]+)sources([^"]+["]|[^ ]+)]]
106-
// FILELIST: -primary-filelist [[PRIMARY_FILELIST:(["][^"]+|[^ ]+)primaryInputs([^"]+["]|[^ ]+)]]
107-
// FILELIST: -supplementary-output-file-map [[SUPPLEMENTARY_OUTPUT_FILEMAP:(["][^"]+|[^ ]+)supplementaryOutputs([^"]+["]|[^ ]+)]]
121+
// FILELIST: -filelist [[SOURCES:(["][^"]+sources[^"]+["]|[^ ]+sources[^ ]+)]]
122+
// FILELIST: -primary-filelist {{(["][^"]+primaryInputs[^"]+["]|[^ ]+primaryInputs[^ ]+)}}
123+
// FILELIST: -supplementary-output-file-map {{(["][^"]+supplementaryOutputs[^"]+["]|[^ ]+supplementaryOutputs[^ ]+)}}
108124
// FILELIST: -output-filelist {{[^-]}}
109125
// FILELIST-NEXT: bin/swift
110126
// FILELIST: -filelist [[SOURCES]]
111-
// FILELIST: -primary-filelist {{(["][^"]+|[^ ]+)primaryInputs([^"]+["]|[^ ]+)}}
112-
// FILELIST: -supplementary-output-file-map {{(["][^"]+|[^ ]+)supplementaryOutputs([^"]+["]|[^ ]+)}}
127+
// FILELIST: -primary-filelist {{(["][^"]+primaryInputs[^"]+["]|[^ ]+primaryInputs[^ ]+)}}
128+
// FILELIST: -supplementary-output-file-map {{(["][^"]+supplementaryOutputs[^"]+["]|[^ ]+supplementaryOutputs[^ ]+)}}
113129
// FILELIST: -output-filelist {{[^-]}}
114130

115131
// UPDATE-CODE: DISTINCTIVE-PATH/usr/bin/swift

test/Driver/filelists.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
// CHECK-NOT: Handled
77
// CHECK: Handled a.swift
88
// CHECK-NEXT: Supplementary "./a.swift":
9-
// CHECK-NEXT: Supplementary swiftdoc: "./a.swiftdoc"
109
// CHECK-NEXT: Supplementary swiftmodule: "./a.swiftmodule"
10+
// CHECK-NEXT: Supplementary swiftdoc: "./a.swiftdoc"
1111
// CHECK-NEXT: Handled b.swift
1212
// CHECK-NEXT: Supplementary "./b.swift":
13-
// CHECK-NEXT: Supplementary swiftdoc: "./b.swiftdoc"
1413
// CHECK-NEXT: Supplementary swiftmodule: "./b.swiftmodule"
14+
// CHECK-NEXT: Supplementary swiftdoc: "./b.swiftdoc"
1515
// CHECK-NEXT: Handled c.swift
1616
// CHECK-NEXT: Supplementary "./c.swift":
17-
// CHECK-NEXT: Supplementary swiftdoc: "./c.swiftdoc"
1817
// CHECK-NEXT: Supplementary swiftmodule: "./c.swiftmodule"
18+
// CHECK-NEXT: Supplementary swiftdoc: "./c.swiftdoc"
1919
// CHECK-NEXT: Handled modules
2020
// CHECK-NOT: Handled
2121

test/Frontend/ast-dump.swift

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: echo 'public func a() { }' >%t/a.swift
3+
// RUN: echo 'public func b() { }' >%t/b.swift
4+
// RUN: echo 'public func main() {a(); b()}' >%t/main.swift
5+
6+
// Test printing to stdout
7+
// RUN: %target-swift-frontend -dump-ast -primary-file %t/a.swift %t/b.swift %t/main.swift -module-name main -o - 2>&1 | %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>&1 | %FileCheck -check-prefix B-AST %s
9+
// RUN: %target-swift-frontend -dump-ast %t/a.swift %t/b.swift -primary-file %t/main.swift -module-name main -o - 2>&1 | %FileCheck -check-prefix MAIN-AST %s
10+
11+
// Test printing to files
12+
// RUN: %target-swift-frontend -dump-ast -primary-file %t/a.swift %t/b.swift %t/main.swift -module-name main -o %t/a.ast
13+
// RUN: %FileCheck -check-prefix A-AST %s < %t/a.ast
14+
// RUN: %target-swift-frontend -dump-ast %t/a.swift -primary-file %t/b.swift %t/main.swift -module-name main -o %t/b.ast
15+
// RUN: %FileCheck -check-prefix B-AST %s < %t/b.ast
16+
// RUN: %target-swift-frontend -dump-ast %t/a.swift %t/b.swift -primary-file %t/main.swift -module-name main -o %t/main.ast
17+
// RUN: %FileCheck -check-prefix MAIN-AST %s < %t/main.ast
18+
19+
// Test batch mode
20+
// RUN: %target-swift-frontend -dump-ast -primary-file %t/a.swift -primary-file %t/b.swift -primary-file %t/main.swift -module-name main -o %t/a_batch.ast -o %t/b_batch.ast -o %t/main_batch.ast
21+
// RUN: %FileCheck -check-prefix A-AST %s < %t/a_batch.ast
22+
// RUN: %FileCheck -check-prefix B-AST %s < %t/b_batch.ast
23+
// RUN: %FileCheck -check-prefix MAIN-AST %s < %t/main_batch.ast
24+
25+
26+
// Check a.swift's AST
27+
// A-AST: (source_file
28+
// A-AST-SAME: a.swift
29+
30+
// A-AST-NEXT: (func_decl
31+
// A-AST-SAME: a()
32+
33+
34+
// Check b.swift's AST
35+
// B-AST: (source_file
36+
// B-AST-SAME: b.swift
37+
38+
// B-AST-NEXT: (func_decl
39+
// B-AST-SAME: b()
40+
41+
42+
// Check main.swift's AST
43+
// MAIN-AST: (source_file
44+
// MAIN-AST-SAME: main.swift
45+
46+
// MAIN-AST: (func_decl
47+
// MAIN-AST-SAME: main()
48+
49+
// MAIN-AST: (call_expr
50+
// MAIN-AST-NEXT: a()
51+
52+
// MAIN-AST: (call_expr
53+
// MAIN-AST-NEXT: b()

test/Frontend/dump-parse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: not %target-swift-frontend -dump-parse %s 2>&1 | %FileCheck %s
2-
// RUN: not %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s -check-prefix=CHECK-AST
2+
// RUN: not %target-swift-frontend -dump-ast %s | %FileCheck %s -check-prefix=CHECK-AST
33

44
// CHECK-LABEL: (func_decl{{.*}}"foo(_:)"
55
// CHECK-AST-LABEL: (func_decl{{.*}}"foo(_:)"
@@ -73,4 +73,4 @@ func nonescaping(_: (Int) -> Int) {}
7373
nonescaping({ $0 })
7474
// CHECK-AST: (declref_expr type='((Int) -> Int) -> ()'
7575
// CHECK-AST-NEXT: (paren_expr
76-
// CHECK-AST-NEXT: (closure_expr type='(Int) -> Int' {{.*}} discriminator=1 single-expression
76+
// CHECK-AST-NEXT: (closure_expr type='(Int) -> Int' {{.*}} discriminator=1 single-expression

test/NameBinding/import-resolution-overload.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/overload_vars.swift
55
// RUN: %target-swift-frontend -typecheck %s -I %t -sdk "" -verify
66

7-
// RUN: not %target-swift-frontend -dump-ast %s -I %t -sdk "" > %t.astdump 2>&1
7+
// RUN: not %target-swift-frontend -dump-ast %s -I %t -sdk "" > %t.astdump
88
// RUN: %FileCheck %s < %t.astdump
99

1010
import overload_intFunctions

test/Parse/if_expr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s
22

33
// CHECK: (func_decl{{.*}}"r13756261(_:_:)"
44
func r13756261(_ x: Bool, _ y: Int) -> Int {

test/Parse/multiline_normalize_newline.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -dump-parse %s 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -dump-parse %s | %FileCheck %s
22

33
// CR
44
_ = """"""

test/Parse/multiline_string.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s
22

33
import Swift
44

test/Parse/raw_string.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck --strict-whitespace %s
1+
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck --strict-whitespace %s
22

33
import Swift
44

test/attr/attr_fixed_layout.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -typecheck -swift-version 4.2 -verify -dump-ast -enable-resilience %s 2>&1 | %FileCheck --check-prefix=RESILIENCE-ON %s
2-
// RUN: %target-swift-frontend -typecheck -swift-version 4.2 -verify -dump-ast -enable-resilience -enable-testing %s 2>&1 | %FileCheck --check-prefix=RESILIENCE-ON %s
3-
// RUN: not %target-swift-frontend -typecheck -swift-version 4.2 -dump-ast %s 2>&1 | %FileCheck --check-prefix=RESILIENCE-OFF %s
4-
// RUN: not %target-swift-frontend -typecheck -swift-version 4.2 -dump-ast %s -enable-testing 2>&1 | %FileCheck --check-prefix=RESILIENCE-OFF %s
1+
// RUN: %target-swift-frontend -typecheck -swift-version 4.2 -verify -dump-ast -enable-resilience %s | %FileCheck --check-prefix=RESILIENCE-ON %s
2+
// RUN: %target-swift-frontend -typecheck -swift-version 4.2 -verify -dump-ast -enable-resilience -enable-testing %s | %FileCheck --check-prefix=RESILIENCE-ON %s
3+
// RUN: not %target-swift-frontend -typecheck -swift-version 4.2 -dump-ast %s | %FileCheck --check-prefix=RESILIENCE-OFF %s
4+
// RUN: not %target-swift-frontend -typecheck -swift-version 4.2 -dump-ast %s -enable-testing | %FileCheck --check-prefix=RESILIENCE-OFF %s
55

66
//
77
// Public types with @_fixed_layout are always fixed layout

test/attr/attr_native_dynamic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -swift-version 5 -typecheck -dump-ast %s 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -swift-version 5 -typecheck -dump-ast %s | %FileCheck %s
22

33
struct Strukt {
44
// CHECK: (struct_decl {{.*}} "Strukt"

test/attr/attr_objc.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -typecheck -verify %s -swift-version 4 -enable-source-import -I %S/Inputs -enable-swift3-objc-inference
22
// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module -swift-version 4 -enable-source-import -I %S/Inputs -enable-swift3-objc-inference | %FileCheck %s
3-
// RUN: not %target-swift-frontend -typecheck -dump-ast -disable-objc-attr-requires-foundation-module %s -swift-version 4 -enable-source-import -I %S/Inputs -enable-swift3-objc-inference 2> %t.dump
4-
// RUN: %FileCheck -check-prefix CHECK-DUMP %s < %t.dump
3+
// RUN: not %target-swift-frontend -typecheck -dump-ast -disable-objc-attr-requires-foundation-module %s -swift-version 4 -enable-source-import -I %S/Inputs -enable-swift3-objc-inference > %t.ast
4+
// RUN: %FileCheck -check-prefix CHECK-DUMP %s < %t.ast
55
// REQUIRES: objc_interop
66

77
import Foundation

0 commit comments

Comments
 (0)