mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Emit the category documentation URL into serialized diagnostics as part of the existing RECORD_CATEGORY, using the form <category name>@<category URL> and keeping the existing "category name length" field referring to the length of the category name itself (up to the @). There is a corresponding update to libclang to process such category names correctly and add API, but it isn't strictly necessary: readers that use the category name length field correctly will see no behavior change, whereas readers that ignore it will merely see the extra `@<category URL>`. This is a step toward staging out our (mis)use of the "flags" field as the place to stash educational note and diagnostic group documentation URLs.
26 lines
1.0 KiB
Swift
26 lines
1.0 KiB
Swift
// %target-swift-frontend -no-color-diagnostics -print-diagnostic-groups -diagnostic-documentation-path %S/test-docs/ -typecheck %s -strict-memory-safety
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -typecheck -no-color-diagnostics -print-diagnostic-groups -diagnostic-documentation-path %S/test-docs/ -serialize-diagnostics-path %t/serialized.dia %s -strict-memory-safety
|
|
// RUN: c-index-test -read-diagnostics %t/serialized.dia > %t/serialized.txt 2>&1
|
|
// RUN: %FileCheck %s < %t/serialized.txt
|
|
|
|
@available(*, deprecated, message: "please do not use")
|
|
func f() { }
|
|
|
|
func g() {
|
|
f()
|
|
// CHECK: [[@LINE-1]]:3: warning: 'f()' is deprecated: please do not use [DeprecatedDeclaration] [-W{{.*}}deprecated-declaration.md] [DeprecatedDeclaration]
|
|
}
|
|
|
|
|
|
@unsafe
|
|
func beCareful() { }
|
|
|
|
func test() {
|
|
beCareful()
|
|
// CHECK: [[@LINE-1]]:3: warning: expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety] [-W{{.*}}strict-memory-safety.md] [StrictMemorySafety]
|
|
}
|
|
|
|
// CHECK: [StrictMemorySafety]: <{{.*}}strict-memory-safety.md>
|