Files
swift-mirror/test/SourceKit/Diagnostics/diag_in_c_header.swift
Hamish Knight 62b021030f [SourceKit] Include generated macro buffers in diagnostic responses
Introduce a new key `generated_buffers`, which
stores an array of generated buffers. These
include the buffer text, as well as its original
location and any parent buffers.

While here, also fix rdar://107281079 such that
only apply the filename fallback logic to the
pretty-printed Decl case. We ought to remove this
fallback once the editor can handle it though.

rdar://107281079
rdar://107952288
2023-05-02 16:21:44 +01:00

45 lines
1.4 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %sourcekitd-test -req=diags %t/main.swift -- %t/main.swift -I %t | %FileCheck %s
//--- Header.h
#define FOO(x) #x
//--- module.modulemap
module HeaderWithMacro {
header "Header.h"
}
//--- main.swift
import HeaderWithMacro
_ = FOO(5)
// rdar://107281079 Make sure the note points in the .h file
// CHECK: key.diagnostics: [
// CHECK-NEXT: {
// CHECK-NEXT: key.line: 3,
// CHECK-NEXT: key.column: 5,
// CHECK-NEXT: key.filepath: "{{.*}}main.swift",
// CHECK-NEXT: key.severity: source.diagnostic.severity.error,
// CHECK-NEXT: key.id: "cannot_find_in_scope",
// CHECK-NEXT: key.description: "cannot find 'FOO' in scope",
// CHECK-NEXT: key.ranges: [
// CHECK-NEXT: {
// CHECK-NEXT: key.offset: 28,
// CHECK-NEXT: key.length: 3
// CHECK-NEXT: }
// CHECK-NEXT: ],
// CHECK-NEXT: key.diagnostics: [
// CHECK-NEXT: {
// CHECK-NEXT: key.line: 1,
// CHECK-NEXT: key.column: 9,
// CHECK-NEXT: key.filepath: "{{.*}}Header.h",
// CHECK-NEXT: key.severity: source.diagnostic.severity.note,
// CHECK-NEXT: key.id: "macro_not_imported_function_like",
// CHECK-NEXT: key.description: "macro 'FOO' unavailable: function like macros not supported"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]