Skip to content

Commit 0c9c734

Browse files
authored
Merge pull request #71722 from DougGregor/diagnostic-style-swift-default
2 parents 44c5f9f + d9faff1 commit 0c9c734

File tree

74 files changed

+173
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+173
-147
lines changed

include/swift/Basic/DiagnosticOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class DiagnosticOptions {
7070
bool PrintEducationalNotes = false;
7171

7272
/// Whether to emit diagnostics in the terse LLVM style or in a more
73-
/// descriptive style that's specific to Swift (currently experimental).
74-
FormattingStyle PrintedFormattingStyle = FormattingStyle::LLVM;
73+
/// descriptive style that's specific to Swift.
74+
FormattingStyle PrintedFormattingStyle = FormattingStyle::Swift;
7575

7676
/// Whether to emit macro expansion buffers into separate, temporary files.
7777
bool EmitMacroExpansionFiles = true;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
19781978
OPT_no_color_diagnostics,
19791979
/*Default=*/llvm::sys::Process::StandardErrHasColors());
19801980
// If no style options are specified, default to LLVM style.
1981-
Opts.PrintedFormattingStyle = DiagnosticOptions::FormattingStyle::LLVM;
1981+
Opts.PrintedFormattingStyle = DiagnosticOptions::FormattingStyle::Swift;
19821982
if (const Arg *arg = Args.getLastArg(OPT_diagnostic_style)) {
19831983
StringRef contents = arg->getValue();
19841984
if (contents == "llvm") {

stdlib/public/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
4949
list(APPEND SWIFT_RUNTIME_CORE_CXX_FLAGS "-xc++")
5050
endif()
5151

52-
# Use the new diagnostic formatter.
53-
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "-diagnostic-style" "swift")
54-
5552
# We should avoid non-literals in format strings, or appropriately mark
5653
# functions.
5754
check_cxx_compiler_flag("-Wformat-nonliteral -Werror=format-nonliteral" CXX_SUPPORTS_FORMAT_NONLITERAL_WARNING)

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
170170
SWIFT_COMPILE_FLAGS
171171
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
172172
-parse-stdlib
173-
-diagnostic-style swift
174173
${SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS}
175174
${swift_concurrency_options}
176175
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"

test/CAS/educational-notes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// RUN: not %target-swift-frontend -color-diagnostics -diagnostic-style=llvm -print-educational-notes -diagnostic-documentation-path %S/../diagnostics/test-docs/ \
1313
// RUN: -emit-module -emit-module-path %t/test.module @%t/MyApp.cmd %s 2>&1 | %FileCheck %s --match-full-lines --strict-whitespace
14-
// RUN: not %target-swift-frontend -no-color-diagnostics -print-educational-notes -diagnostic-documentation-path %S/../diagnostics/test-docs/ \
14+
// RUN: not %target-swift-frontend -no-color-diagnostics -diagnostic-style=llvm -print-educational-notes -diagnostic-documentation-path %S/../diagnostics/test-docs/ \
1515
// RUN: -emit-module -emit-module-path %t/test.module @%t/MyApp.cmd %s 2>&1 | %FileCheck %s --match-full-lines --strict-whitespace --check-prefix=NO-COLOR
1616

1717
// A diagnostic with no educational notes

test/ClangImporter/AllowErrors/invalid-pch-bridging-header.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ struct InnerTy {
4545

4646
//--- use.swift
4747
func use(s: SomeTy, s2: InnerTy) {}
48+
49+
// Note: extra newlines below ensure that context printing doesn't show the
50+
// lines that we shouldn't see.
51+
52+
4853
// MISSING_HMAP-NOT: cannot find type 'SomeTy' in scope
4954
// MISSING_HMAP: cannot find type 'InnerTy' in scope
5055
// MISSING_HMAP-NOT: cannot find type 'SomeTy' in scope

test/ClangImporter/Inputs/custom-modules/ImportAsMember.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ typedef float MNInnerFloat __attribute__((swift_name("IAMMultipleNested.Inner"))
7171
typedef int IAMBadInnerInt
7272
__attribute__((swift_name("IAMNonexistent.Inner")));
7373
// CHECK: ImportAsMember.h:[[@LINE-1]]:{{[0-9]+}}: warning: imported declaration 'IAMBadInnerInt' could not be mapped to 'IAMNonexistent.Inner'
74-
// CHECK: ImportAsMember.h:[[@LINE-2]]:{{[0-9]+}}: note: please report this issue to the owners of 'ImportAsMember'
74+
// CHECK: note: please report this issue to the owners of 'ImportAsMember'
7575
typedef int IAMBadInnerIntAPINotes;
7676
// CHECK: ImportAsMember.h:[[@LINE-1]]:{{[0-9]+}}: warning: imported declaration 'IAMBadInnerIntAPINotes' could not be mapped to 'IAMNonexistent.Inner2'
77-
// CHECK: ImportAsMember.h:[[@LINE-2]]:{{[0-9]+}}: note: please report this issue to the owners of 'ImportAsMember'
77+
// CHECK: note: please report this issue to the owners of 'ImportAsMember'
7878

7979
@interface IAMPrivateParent @end
8080
@interface IAMPrivateChild

test/ClangImporter/MixedSource/broken-bridging-header.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/fake.h 2>&1 | %FileCheck -check-prefix=MISSING-HEADER %s
2+
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/fake.h -diagnostic-style llvm 2>&1 | %FileCheck -check-prefix=MISSING-HEADER %s
33

44
// RUN: cp %S/Inputs/error-on-define.h %t
5-
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
5+
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h -diagnostic-style llvm 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
66

77
// RUN: cp %S/Inputs/error-on-define-impl.h %t
8-
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h -Xcc -DERROR 2>&1 | %FileCheck -check-prefix=HEADER-ERROR %s
8+
// RUN: not %target-swift-frontend -typecheck %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h -Xcc -DERROR -diagnostic-style llvm 2>&1 | %FileCheck -check-prefix=HEADER-ERROR %s
99

1010

11-
// RUN: %target-swift-frontend -emit-module -o %t -module-name HasBridgingHeader %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h
11+
// RUN: %target-swift-frontend -emit-module -o %t -module-name HasBridgingHeader %S/../../Inputs/empty.swift -enable-objc-interop -import-objc-header %t/error-on-define.h -diagnostic-style llvm
1212

1313
// RUN: %target-swift-frontend -typecheck %s -I %t -Xcc -DERROR -verify -show-diagnostics-after-fatal
14-
// RUN: not %target-swift-frontend -typecheck %s -I %t -Xcc -DERROR 2>&1 | %FileCheck -check-prefix=HEADER-ERROR %s
14+
// RUN: not %target-swift-frontend -typecheck %s -I %t -Xcc -DERROR 2>&1 -diagnostic-style llvm | %FileCheck -check-prefix=HEADER-ERROR %s
1515

1616
// RUN: rm %t/error-on-define-impl.h
17-
// RUN: %target-swift-frontend -typecheck %s -I %t -verify -show-diagnostics-after-fatal
18-
// RUN: not %target-swift-frontend -typecheck %s -I %t 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
17+
// RUN: %target-swift-frontend -typecheck %s -I %t -verify -show-diagnostics-after-fatal -diagnostic-style llvm
18+
// RUN: not %target-swift-frontend -typecheck %s -I %t -diagnostic-style llvm 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
1919

2020
import HasBridgingHeader // expected-error {{failed to import bridging header}} expected-error {{failed to load module 'HasBridgingHeader'}}
2121

test/ClangImporter/MixedSource/broken-modules.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: not %target-swift-frontend -enable-objc-interop -typecheck %/s -I %S/Inputs/broken-modules/ -enable-source-import -show-diagnostics-after-fatal -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK -check-prefix CLANG-CHECK %s
3+
// RUN: not %target-swift-frontend -enable-objc-interop -typecheck %/s -I %S/Inputs/broken-modules/ -enable-source-import -show-diagnostics-after-fatal -diagnostic-style llvm -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK -check-prefix CLANG-CHECK %s
44

5-
// RUN: not %target-swift-frontend -typecheck %/s -enable-objc-interop -import-objc-header %S/Inputs/broken-modules/BrokenClangModule.h -enable-source-import -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK-BRIDGING-HEADER -check-prefix CLANG-CHECK %s
5+
// RUN: not %target-swift-frontend -typecheck %/s -enable-objc-interop -import-objc-header %S/Inputs/broken-modules/BrokenClangModule.h -enable-source-import -diagnostic-style llvm -o /dev/null 2>&1 | %FileCheck -check-prefix CHECK-BRIDGING-HEADER -check-prefix CLANG-CHECK %s
66

7-
// RUN: not %target-swift-frontend -typecheck %s -enable-objc-interop -import-objc-header %S/../../Inputs/empty.swift 2>&1 | %FileCheck -check-prefix=EMPTY-HEADER %s
7+
// RUN: not %target-swift-frontend -typecheck %s -enable-objc-interop -import-objc-header %S/../../Inputs/empty.swift -diagnostic-style llvm 2>&1 | %FileCheck -check-prefix=EMPTY-HEADER %s
88

99
// EMPTY-HEADER-NOT: header
1010

test/ClangImporter/attr-swift_name.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t.mcp)
2-
// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -typecheck %s -module-cache-path %t.mcp 2>&1 | %FileCheck %s
2+
// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -typecheck %s -diagnostic-style llvm -module-cache-path %t.mcp 2>&1 | %FileCheck %s
33

44
// REQUIRES: objc_interop
55

0 commit comments

Comments
 (0)