mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Abstracted service for @cdecl style attributes
This commit is contained in:
@@ -8172,6 +8172,11 @@ public:
|
|||||||
/// instance method.
|
/// instance method.
|
||||||
bool isObjCInstanceMethod() const;
|
bool isObjCInstanceMethod() const;
|
||||||
|
|
||||||
|
/// Get the foreign language targeted by a @cdecl-style attribute, if any.
|
||||||
|
/// Used to abstract away the change in meaning of @cdecl vs @_cdecl while
|
||||||
|
/// formalizing the attribute.
|
||||||
|
std::optional<ForeignLanguage> getCDeclKind() const;
|
||||||
|
|
||||||
/// Determine whether the name of an argument is an API name by default
|
/// Determine whether the name of an argument is an API name by default
|
||||||
/// depending on the function context.
|
/// depending on the function context.
|
||||||
bool argumentNameIsAPIByDefault() const;
|
bool argumentNameIsAPIByDefault() const;
|
||||||
|
|||||||
@@ -10615,6 +10615,15 @@ bool AbstractFunctionDecl::isObjCInstanceMethod() const {
|
|||||||
return isInstanceMember() || isa<ConstructorDecl>(this);
|
return isInstanceMember() || isa<ConstructorDecl>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<ForeignLanguage> AbstractFunctionDecl::getCDeclKind() const {
|
||||||
|
auto attr = getAttrs().getAttribute<CDeclAttr>();
|
||||||
|
if (!attr)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return attr->Underscored ? ForeignLanguage::ObjectiveC
|
||||||
|
: ForeignLanguage::C;
|
||||||
|
}
|
||||||
|
|
||||||
bool AbstractFunctionDecl::needsNewVTableEntry() const {
|
bool AbstractFunctionDecl::needsNewVTableEntry() const {
|
||||||
auto &ctx = getASTContext();
|
auto &ctx = getASTContext();
|
||||||
return evaluateOrDefault(
|
return evaluateOrDefault(
|
||||||
|
|||||||
Reference in New Issue
Block a user