Skip to content

Commit 96ddf44

Browse files
vguerrajrose-apple
authored andcommitted
[Diagnostics] Hooking up remarks emitted from Clang. (#25585)
Now that Swift support remarks ClangImporter we pass them to the Clang diagnostic producer instead of ignoring them. Fixes SR-10915
1 parent 7351b40 commit 96ddf44

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
//
1818
//===----------------------------------------------------------------------===//
1919

20-
#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE)))
21-
# error Must define either DIAG or the set {ERROR,WARNING,NOTE}
20+
#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && defined(REMARK)))
21+
# error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
2222
#endif
2323

2424
#ifndef ERROR
@@ -36,12 +36,19 @@
3636
DIAG(NOTE,ID,Options,Text,Signature)
3737
#endif
3838

39+
#ifndef REMARK
40+
# define REMARK(ID,Options,Text,Signature) \
41+
DIAG(REMARK,ID,Options,Text,Signature)
42+
#endif
43+
3944
WARNING(warning_from_clang,none,
4045
"%0", (StringRef))
4146
ERROR(error_from_clang,none,
4247
"%0", (StringRef))
4348
NOTE(note_from_clang,none,
4449
"%0", (StringRef))
50+
REMARK(remark_from_clang,none,
51+
"%0", (StringRef))
4552

4653
ERROR(clang_cannot_build_module,Fatal,
4754
"could not build %select{C|Objective-C}0 module '%1'", (bool, StringRef))

lib/ClangImporter/ClangDiagnosticConsumer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ void ClangDiagnosticConsumer::HandleDiagnostic(
227227
diagKind = diag::note_from_clang;
228228
break;
229229
case clang::DiagnosticsEngine::Remark:
230-
// FIXME: We don't handle remarks yet.
231-
return;
230+
diagKind = diag::remark_from_clang;
231+
break;
232232
case clang::DiagnosticsEngine::Warning:
233233
diagKind = diag::warning_from_clang;
234234
break;

test/ClangImporter/remarks.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %target-swift-frontend -typecheck %s -Xcc -Rmodule-import -I %S/Inputs/custom-modules 2>&1 | %FileCheck %s
2+
3+
import Requires.Swift
4+
// CHECK-NOT: error
5+
// CHECK: remark: importing module 'SwiftShims'
6+
// CHECK-NEXT: remark: importing module 'Requires'

0 commit comments

Comments
 (0)