mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Use ForeignLanguage directly in diagnostic definitions
This commit is contained in:
@@ -55,6 +55,7 @@ namespace swift {
|
|||||||
} // end namespace detail
|
} // end namespace detail
|
||||||
|
|
||||||
enum class StaticSpellingKind : uint8_t;
|
enum class StaticSpellingKind : uint8_t;
|
||||||
|
enum class ForeignLanguage : uint8_t;
|
||||||
|
|
||||||
namespace diag {
|
namespace diag {
|
||||||
|
|
||||||
|
|||||||
@@ -6612,19 +6612,19 @@ ERROR(objc_invalid_on_func_variadic,none,
|
|||||||
ERROR(objc_invalid_on_func_inout,none,
|
ERROR(objc_invalid_on_func_inout,none,
|
||||||
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because inout "
|
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because inout "
|
||||||
"parameters cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
"parameters cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
||||||
(const AbstractFunctionDecl*, unsigned, unsigned))
|
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
|
||||||
ERROR(objc_invalid_on_func_param_type,none,
|
ERROR(objc_invalid_on_func_param_type,none,
|
||||||
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "2 because the type of the "
|
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "2 because the type of the "
|
||||||
"parameter %1 cannot be represented in %" FOREIGN_LANG_SELECT "3",
|
"parameter %1 cannot be represented in %" FOREIGN_LANG_SELECT "3",
|
||||||
(const AbstractFunctionDecl*, unsigned, unsigned, unsigned))
|
(const AbstractFunctionDecl*, unsigned, unsigned, ForeignLanguage))
|
||||||
ERROR(objc_invalid_on_func_single_param_type,none,
|
ERROR(objc_invalid_on_func_single_param_type,none,
|
||||||
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because the type of the "
|
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because the type of the "
|
||||||
"parameter cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
"parameter cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
||||||
(const AbstractFunctionDecl*, unsigned, unsigned))
|
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
|
||||||
ERROR(objc_invalid_on_func_result_type,none,
|
ERROR(objc_invalid_on_func_result_type,none,
|
||||||
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because its result type "
|
"%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because its result type "
|
||||||
"cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
"cannot be represented in %" FOREIGN_LANG_SELECT "2",
|
||||||
(const AbstractFunctionDecl*, unsigned, unsigned))
|
(const AbstractFunctionDecl*, unsigned, ForeignLanguage))
|
||||||
ERROR(objc_invalid_on_foreign_class,none,
|
ERROR(objc_invalid_on_foreign_class,none,
|
||||||
"method cannot be %" OBJC_ATTR_SELECT "0 because Core Foundation "
|
"method cannot be %" OBJC_ATTR_SELECT "0 because Core Foundation "
|
||||||
"types are not classes in Objective-C", (unsigned))
|
"types are not classes in Objective-C", (unsigned))
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ inline SubstOptions operator|(SubstFlags lhs, SubstFlags rhs) {
|
|||||||
|
|
||||||
/// Enumeration describing foreign languages to which Swift may be
|
/// Enumeration describing foreign languages to which Swift may be
|
||||||
/// bridged.
|
/// bridged.
|
||||||
enum class ForeignLanguage {
|
enum class ForeignLanguage : uint8_t {
|
||||||
C,
|
C,
|
||||||
ObjectiveC,
|
ObjectiveC,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -305,13 +305,13 @@ static void diagnoseFunctionParamNotRepresentable(
|
|||||||
softenIfAccessNote(AFD, Reason.getAttr(),
|
softenIfAccessNote(AFD, Reason.getAttr(),
|
||||||
AFD->diagnose(diag::objc_invalid_on_func_single_param_type,
|
AFD->diagnose(diag::objc_invalid_on_func_single_param_type,
|
||||||
AFD, getObjCDiagnosticAttrKind(Reason),
|
AFD, getObjCDiagnosticAttrKind(Reason),
|
||||||
(unsigned)language)
|
language)
|
||||||
.limitBehavior(behavior));
|
.limitBehavior(behavior));
|
||||||
} else {
|
} else {
|
||||||
softenIfAccessNote(AFD, Reason.getAttr(),
|
softenIfAccessNote(AFD, Reason.getAttr(),
|
||||||
AFD->diagnose(diag::objc_invalid_on_func_param_type,
|
AFD->diagnose(diag::objc_invalid_on_func_param_type,
|
||||||
AFD, ParamIndex + 1, getObjCDiagnosticAttrKind(Reason),
|
AFD, ParamIndex + 1, getObjCDiagnosticAttrKind(Reason),
|
||||||
(unsigned)language)
|
language)
|
||||||
.limitBehavior(behavior));
|
.limitBehavior(behavior));
|
||||||
}
|
}
|
||||||
SourceRange SR;
|
SourceRange SR;
|
||||||
@@ -358,7 +358,7 @@ static bool isParamListRepresentableInLanguage(const AbstractFunctionDecl *AFD,
|
|||||||
softenIfAccessNote(AFD, Reason.getAttr(),
|
softenIfAccessNote(AFD, Reason.getAttr(),
|
||||||
diags.diagnose(param->getStartLoc(), diag::objc_invalid_on_func_inout,
|
diags.diagnose(param->getStartLoc(), diag::objc_invalid_on_func_inout,
|
||||||
AFD, getObjCDiagnosticAttrKind(Reason),
|
AFD, getObjCDiagnosticAttrKind(Reason),
|
||||||
(unsigned)language)
|
language)
|
||||||
.highlight(param->getSourceRange())
|
.highlight(param->getSourceRange())
|
||||||
.limitBehavior(behavior));
|
.limitBehavior(behavior));
|
||||||
Reason.describe(AFD);
|
Reason.describe(AFD);
|
||||||
@@ -800,7 +800,7 @@ bool swift::isRepresentableInLanguage(
|
|||||||
softenIfAccessNote(AFD, Reason.getAttr(),
|
softenIfAccessNote(AFD, Reason.getAttr(),
|
||||||
AFD->diagnose(diag::objc_invalid_on_func_result_type,
|
AFD->diagnose(diag::objc_invalid_on_func_result_type,
|
||||||
FD, getObjCDiagnosticAttrKind(Reason),
|
FD, getObjCDiagnosticAttrKind(Reason),
|
||||||
(unsigned)language)
|
language)
|
||||||
.limitBehavior(behavior));
|
.limitBehavior(behavior));
|
||||||
diagnoseTypeNotRepresentableInObjC(FD, ResultType,
|
diagnoseTypeNotRepresentableInObjC(FD, ResultType,
|
||||||
FD->getResultTypeSourceRange(),
|
FD->getResultTypeSourceRange(),
|
||||||
@@ -857,7 +857,7 @@ bool swift::isRepresentableInLanguage(
|
|||||||
softenIfAccessNote(AFD, Reason.getAttr(),
|
softenIfAccessNote(AFD, Reason.getAttr(),
|
||||||
AFD->diagnose(diag::objc_invalid_on_func_result_type,
|
AFD->diagnose(diag::objc_invalid_on_func_result_type,
|
||||||
FD, getObjCDiagnosticAttrKind(Reason),
|
FD, getObjCDiagnosticAttrKind(Reason),
|
||||||
(unsigned)language)
|
language)
|
||||||
.limitBehavior(behavior));
|
.limitBehavior(behavior));
|
||||||
diagnoseTypeNotRepresentableInObjC(FD, type,
|
diagnoseTypeNotRepresentableInObjC(FD, type,
|
||||||
FD->getResultTypeSourceRange(),
|
FD->getResultTypeSourceRange(),
|
||||||
|
|||||||
Reference in New Issue
Block a user