Skip to content

Commit 0600ddd

Browse files
committed
Sema: Use ForeignLanguage directly in diagnostic definitions
1 parent e11afb5 commit 0600ddd

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
@@ -48,6 +48,7 @@ namespace swift {
4848
} // end namespace detail
4949

5050
enum class StaticSpellingKind : uint8_t;
51+
enum class ForeignLanguage : uint8_t;
5152

5253
namespace diag {
5354

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6607,19 +6607,19 @@ ERROR(objc_invalid_on_func_variadic,none,
66076607
ERROR(objc_invalid_on_func_inout,none,
66086608
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because inout "
66096609
"parameters cannot be represented in %" FOREIGN_LANG_SELECT "2",
6610-
(const AbstractFunctionDecl*, unsigned, unsigned))
6610+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66116611
ERROR(objc_invalid_on_func_param_type,none,
66126612
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "2 because the type of the "
66136613
"parameter %1 cannot be represented in %" FOREIGN_LANG_SELECT "3",
6614-
(const AbstractFunctionDecl*, unsigned, unsigned, unsigned))
6614+
(const AbstractFunctionDecl*, unsigned, unsigned, ForeignLanguage))
66156615
ERROR(objc_invalid_on_func_single_param_type,none,
66166616
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because the type of the "
66176617
"parameter cannot be represented in %" FOREIGN_LANG_SELECT "2",
6618-
(const AbstractFunctionDecl*, unsigned, unsigned))
6618+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66196619
ERROR(objc_invalid_on_func_result_type,none,
66206620
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because its result type "
66216621
"cannot be represented in %" FOREIGN_LANG_SELECT "2",
6622-
(const AbstractFunctionDecl*, unsigned, unsigned))
6622+
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
66236623
ERROR(objc_invalid_on_foreign_class,none,
66246624
"method cannot be %" OBJC_ATTR_SELECT "0 because Core Foundation "
66256625
"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
@@ -304,13 +304,13 @@ static void diagnoseFunctionParamNotRepresentable(
304304
softenIfAccessNote(AFD, Reason.getAttr(),
305305
AFD->diagnose(diag::objc_invalid_on_func_single_param_type,
306306
AFD, getObjCDiagnosticAttrKind(Reason),
307-
(unsigned)language)
307+
language)
308308
.limitBehavior(behavior));
309309
} else {
310310
softenIfAccessNote(AFD, Reason.getAttr(),
311311
AFD->diagnose(diag::objc_invalid_on_func_param_type,
312312
AFD, ParamIndex + 1, getObjCDiagnosticAttrKind(Reason),
313-
(unsigned)language)
313+
language)
314314
.limitBehavior(behavior));
315315
}
316316
SourceRange SR;
@@ -357,7 +357,7 @@ static bool isParamListRepresentableInLanguage(const AbstractFunctionDecl *AFD,
357357
softenIfAccessNote(AFD, Reason.getAttr(),
358358
diags.diagnose(param->getStartLoc(), diag::objc_invalid_on_func_inout,
359359
AFD, getObjCDiagnosticAttrKind(Reason),
360-
(unsigned)language)
360+
language)
361361
.highlight(param->getSourceRange())
362362
.limitBehavior(behavior));
363363
Reason.describe(AFD);
@@ -801,7 +801,7 @@ bool swift::isRepresentableInLanguage(
801801
softenIfAccessNote(AFD, Reason.getAttr(),
802802
AFD->diagnose(diag::objc_invalid_on_func_result_type,
803803
FD, getObjCDiagnosticAttrKind(Reason),
804-
(unsigned)language)
804+
language)
805805
.limitBehavior(behavior));
806806
diagnoseTypeNotRepresentableInObjC(FD, ResultType,
807807
FD->getResultTypeSourceRange(),
@@ -858,7 +858,7 @@ bool swift::isRepresentableInLanguage(
858858
softenIfAccessNote(AFD, Reason.getAttr(),
859859
AFD->diagnose(diag::objc_invalid_on_func_result_type,
860860
FD, getObjCDiagnosticAttrKind(Reason),
861-
(unsigned)language)
861+
language)
862862
.limitBehavior(behavior));
863863
diagnoseTypeNotRepresentableInObjC(FD, type,
864864
FD->getResultTypeSourceRange(),

0 commit comments

Comments
 (0)