Files
swift-mirror/test/SourceKit/Misc/frontend_compiler_args.swift
Sam Pyankov 67de16c18d [SourceKit] Accept frontend arguments when generating compiler invocation
SourceKit now accepts frontend arguments in addition to driver
arguments. When arguments have '-frontend' in front, they're
considered frontend arguments and they do not require calling legacy driver
and are parsed directly into the invocation. Any array that doesn't start
with '-frontend' is still treated as driver arguments.

rdar://185359034
2026-09-09 09:54:08 -07:00

16 lines
858 B
Swift

func demo() -> Int { return 42 }
// This test ensures sourcekitd accepts frontend arguments (a compiler-args
// list beginning with `-frontend`); the request is sent via
// -json-request-path rather than the natural because that form has
// sourcekitd-test prepend `-module-cache-path` to the request's compiler args,
// which would incorrectly fail this test
// RUN: echo '{ key.request: source.request.cursorinfo, key.sourcefile: "%/s", key.offset: 5, key.compilerargs: [ "-frontend", "-module-name", "Test", "%/s" ] }' > %t.json
// RUN: %sourcekitd-test -json-request-path %t.json | %FileCheck %s
// The module name `Test` is set only through the frontend args, so seeing it
// baked into the USR (`4Test`) proves the frontend path parsed and applied them.
// CHECK: key.kind: source.lang.swift.decl.function.free
// CHECK: key.usr: "s:4Test4demoSiyF"