mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
An "API descriptor" file is JSON describing the externally accessible symbols of a module and metadata associated with those symbols like availability and SPI status. This output was previously only generated by the `swift-api-extract` alias of `swift-frontend`, which is desgined to take an already built module as input. Post-processing a built module to extract this information is inefficient because the module and the module's dependencies need to be deserialized in order to visit the entire AST. We can generate this output more efficiently as a supplementary output of the -emit-module job that originally produced the module (since the AST is already available in-memory). The -emit-api-descriptor flag can be used to request this output. This change lays the groundwork by introducing frontend flags. Follow up changes are needed to make API descriptor emission during -emit-module functional. Part of rdar://110916764.
42 lines
3.6 KiB
Swift
42 lines
3.6 KiB
Swift
// Checks what happens when trying to emit various supplementary outputs from
|
|
// modes that don't support them. This isn't critical because the driver should
|
|
// never ask the frontend to do this, but it's nice for people writing tests.
|
|
|
|
// RUN: not %target-swift-frontend -typecheck -emit-module %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_MODULE %s
|
|
// PARSE_NO_MODULE: error: this mode does not support emitting modules{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-dependencies %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_DEPS %s
|
|
// PARSE_NO_DEPS: error: this mode does not support emitting dependency files{{$}}
|
|
// RUN: not %target-swift-frontend -dump-ast -emit-dependencies %s 2>&1 | %FileCheck -check-prefix=DUMP_NO_DEPS %s
|
|
// DUMP_NO_DEPS: error: this mode does not support emitting dependency files{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-reference-dependencies %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_REFERENCE_DEPS %s
|
|
// PARSE_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
|
|
// RUN: not %target-swift-frontend -dump-ast -emit-reference-dependencies %s 2>&1 | %FileCheck -check-prefix=DUMP_NO_REFERENCE_DEPS %s
|
|
// DUMP_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
|
|
// RUN: not %target-swift-frontend -resolve-imports -emit-reference-dependencies %s 2>&1 | %FileCheck -check-prefix=RESOLVE_IMPORTS_NO_REFERENCE_DEPS %s
|
|
// RESOLVE_IMPORTS_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-objc-header %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_OBJC_HEADER %s
|
|
// PARSE_NO_OBJC_HEADER: error: this mode does not support emitting Objective-C or C++ headers{{$}}
|
|
// RUN: not %target-swift-frontend -dump-ast -emit-objc-header %s 2>&1 | %FileCheck -check-prefix=DUMP_NO_OBJC_HEADER %s
|
|
// DUMP_NO_OBJC_HEADER: error: this mode does not support emitting Objective-C or C++ headers{{$}}
|
|
// RUN: not %target-swift-frontend -resolve-imports -emit-objc-header %s 2>&1 | %FileCheck -check-prefix=RESOLVE_IMPORTS_NO_OBJC_HEADER %s
|
|
// RESOLVE_IMPORTS_NO_OBJC_HEADER: error: this mode does not support emitting Objective-C or C++ headers{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_INTERFACE %s
|
|
// PARSE_NO_INTERFACE: error: this mode does not support emitting module interface files{{$}}
|
|
// RUN: not %target-swift-frontend -emit-silgen -emit-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=SILGEN_NO_INTERFACE %s
|
|
// SILGEN_NO_INTERFACE: error: this mode does not support emitting module interface files{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-private-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_PRIVATE_INTERFACE %s
|
|
// PARSE_NO_PRIVATE_INTERFACE: error: this mode does not support emitting module interface files{{$}}
|
|
// RUN: not %target-swift-frontend -emit-silgen -emit-private-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=SILGEN_NO_PRIVATE_INTERFACE %s
|
|
// SILGEN_NO_PRIVATE_INTERFACE: error: this mode does not support emitting module interface files{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-const-values-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_CONST_VALUES %s
|
|
// PARSE_NO_CONST_VALUES: error: this mode does not support emitting extracted const values{{$}}
|
|
|
|
// RUN: not %target-swift-frontend -parse -emit-api-descriptor-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_API_DESCRIPTOR %s
|
|
// PARSE_NO_API_DESCRIPTOR: error: this mode does not support emitting API descriptor files{{$}}
|