Skip to content

Commit bb99891

Browse files
committed
Sema: Use ForeignLanguage directly in diagnostic definitions
1 parent 9c7f0c7 commit bb99891

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

include/swift/AST/DiagnosticsCommon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace swift {
5555
} // end namespace detail
5656

5757
enum class StaticSpellingKind : uint8_t;
58+
enum class ForeignLanguage : uint8_t;
5859

5960
namespace diag {
6061

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6612,19 +6612,19 @@ ERROR(objc_invalid_on_func_variadic,none,
66126612
ERROR(objc_invalid_on_func_inout,none,
66136613
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because inout "
66146614
"parameters cannot be represented in %" FOREIGN_LANG_SELECT "2",
6615-
(const AbstractFunctionDecl*, unsigned, unsigned))
6615+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66166616
ERROR(objc_invalid_on_func_param_type,none,
66176617
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "2 because the type of the "
66186618
"parameter %1 cannot be represented in %" FOREIGN_LANG_SELECT "3",
6619-
(const AbstractFunctionDecl*, unsigned, unsigned, unsigned))
6619+
(const AbstractFunctionDecl*, unsigned, unsigned, ForeignLanguage))
66206620
ERROR(objc_invalid_on_func_single_param_type,none,
66216621
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because the type of the "
66226622
"parameter cannot be represented in %" FOREIGN_LANG_SELECT "2",
6623-
(const AbstractFunctionDecl*, unsigned, unsigned))
6623+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66246624
ERROR(objc_invalid_on_func_result_type,none,
66256625
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because its result type "
66266626
"cannot be represented in %" FOREIGN_LANG_SELECT "2",
6627-
(const AbstractFunctionDecl*, unsigned, unsigned))
6627+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66286628
ERROR(objc_invalid_on_foreign_class,none,
66296629
"method cannot be %" OBJC_ATTR_SELECT "0 because Core Foundation "
66306630
"types are not classes in Objective-C", (unsigned))

include/swift/AST/Type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ inline SubstOptions operator|(SubstFlags lhs, SubstFlags rhs) {
161161

162162
/// Enumeration describing foreign languages to which Swift may be
163163
/// bridged.
164-
enum class ForeignLanguage {
164+
enum class ForeignLanguage : uint8_t {
165165
C,
166166
ObjectiveC,
167167
};

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ static void diagnoseFunctionParamNotRepresentable(
305305
softenIfAccessNote(AFD, Reason.getAttr(),
306306
AFD->diagnose(diag::objc_invalid_on_func_single_param_type,
307307
AFD, getObjCDiagnosticAttrKind(Reason),
308-
(unsigned)language)
308+
language)
309309
.limitBehavior(behavior));
310310
} else {
311311
softenIfAccessNote(AFD, Reason.getAttr(),
312312
AFD->diagnose(diag::objc_invalid_on_func_param_type,
313313
AFD, ParamIndex + 1, getObjCDiagnosticAttrKind(Reason),
314-
(unsigned)language)
314+
language)
315315
.limitBehavior(behavior));
316316
}
317317
SourceRange SR;
@@ -358,7 +358,7 @@ static bool isParamListRepresentableInLanguage(const AbstractFunctionDecl *AFD,
358358
softenIfAccessNote(AFD, Reason.getAttr(),
359359
diags.diagnose(param->getStartLoc(), diag::objc_invalid_on_func_inout,
360360
AFD, getObjCDiagnosticAttrKind(Reason),
361-
(unsigned)language)
361+
language)
362362
.highlight(param->getSourceRange())
363363
.limitBehavior(behavior));
364364
Reason.describe(AFD);
@@ -800,7 +800,7 @@ bool swift::isRepresentableInLanguage(
800800
softenIfAccessNote(AFD, Reason.getAttr(),
801801
AFD->diagnose(diag::objc_invalid_on_func_result_type,
802802
FD, getObjCDiagnosticAttrKind(Reason),
803-
(unsigned)language)
803+
language)
804804
.limitBehavior(behavior));
805805
diagnoseTypeNotRepresentableInObjC(FD, ResultType,
806806
FD->getResultTypeSourceRange(),
@@ -857,7 +857,7 @@ bool swift::isRepresentableInLanguage(
857857
softenIfAccessNote(AFD, Reason.getAttr(),
858858
AFD->diagnose(diag::objc_invalid_on_func_result_type,
859859
FD, getObjCDiagnosticAttrKind(Reason),
860-
(unsigned)language)
860+
language)
861861
.limitBehavior(behavior));
862862
diagnoseTypeNotRepresentableInObjC(FD, type,
863863
FD->getResultTypeSourceRange(),

0 commit comments

Comments
 (0)