Merge pull request #80159 from AnthonyLatsis/danaus-plexippus-5

Sema: Extend adoption mode for `AsyncCallerExecution` to storage declarations
This commit is contained in:
Anthony Latsis
2025-03-26 04:40:58 +00:00
committed by GitHub
32 changed files with 312 additions and 227 deletions

View File

@@ -3197,6 +3197,11 @@ public:
/// Is this declaration marked with 'dynamic'?
bool isDynamic() const;
/// Returns whether accesses to this declaration are asynchronous.
/// If the declaration is neither `AbstractFunctionDecl` nor
/// `AbstractStorageDecl`, returns `false`.
bool isAsync() const;
private:
bool isObjCDynamic() const {
return isObjC() && isDynamic();
@@ -3320,6 +3325,14 @@ public:
/// parameter lists, for example an enum element without associated values.
bool hasParameterList() const;
/// Returns the parameter list directly associated with this declaration,
/// or `nullptr` if there is none.
///
/// Note that some declarations with function interface types do not have
/// parameter lists. For example, an enum element without associated values.
ParameterList *getParameterList();
const ParameterList *getParameterList() const;
/// Returns the number of curry levels in the declaration's interface type.
unsigned getNumCurryLevels() const;
@@ -9733,14 +9746,6 @@ inline bool ValueDecl::hasCurriedSelf() const {
return false;
}
inline bool ValueDecl::hasParameterList() const {
if (auto *eed = dyn_cast<EnumElementDecl>(this))
return eed->hasAssociatedValues();
if (auto *macro = dyn_cast<MacroDecl>(this))
return macro->parameterList != nullptr;
return isa<AbstractFunctionDecl>(this) || isa<SubscriptDecl>(this);
}
inline unsigned ValueDecl::getNumCurryLevels() const {
unsigned curryLevels = 0;
if (hasParameterList())
@@ -9828,10 +9833,6 @@ inline EnumElementDecl *EnumDecl::getUniqueElement(bool hasValue) const {
return result;
}
/// Retrieve the parameter list for a given declaration, or nullptr if there
/// is none.
ParameterList *getParameterList(ValueDecl *source);
/// Retrieve the parameter list for a given declaration context, or nullptr if
/// there is none.
ParameterList *getParameterList(DeclContext *source);

View File

@@ -862,7 +862,7 @@ DECL_ATTR(abi, ABI,
DECL_ATTR_FEATURE_REQUIREMENT(ABI, ABIAttribute)
DECL_ATTR(execution, Execution,
OnAbstractFunction,
OnFunc | OnConstructor | OnSubscript | OnVar,
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
166)
DECL_ATTR_FEATURE_REQUIREMENT(Execution, ExecutionAttribute)