[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 16 00:51:00 PDT 2024
================
@@ -4429,6 +4434,284 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode {
}
};
+// ------------------------------------------------------------------------------
+
+class Decl;
+class CXXMethodDecl;
+class FunctionTypeEffectsRef;
+class FunctionTypeEffectSet;
+
+/*
+ TODO: Idea about how to move most of the FunctionEffect business out of
+ Type.h, thus removing these forward declarations.
+
+ - Keep FunctionEffect itself here but make it more minimal. Don't define flags
+ or any behaviors, just the Kind and an accessor.
+ - Keep FunctionEffectCondExpr here.
+ - Make FunctionProtoType and ExtProtoInfo use only ArrayRef<FunctionEffect>
+ and ArrayRef<FunctionEffectCondExpr>.
+ - Somewhere in Sema, define ExtFunctionEffect, which holds a FunctionEffect
+ and has all the behavior-related methods.
+ - There too, define the containers. FunctionTypeEffectsRef can have a
+ constructor or factory method that initializes itself from a
+ FunctionProtoType.
+*/
----------------
Sirraide wrote:
A few things that came to mind:
> Keep FunctionEffect itself here but make it more minimal. Don't define flags
or any behaviors, just the Kind and an accessor.
I mean, keeping the flags here seems fine. The function effects are part of the type, so this (or a different header if it gets too long that is then included here) being where all of the effect-related things are declared makes sense.
> Keep FunctionEffectCondExpr here.
I don’t particularly like the name of this class because it ending with `Expr` suggests that it’s a new kind of expression, which it really isn’t; I’d maybe rename it to `FunctionEffectCondition` or sth.
> Somewhere in Sema, define ExtFunctionEffect, which holds a FunctionEffect
and has all the behavior-related methods.
One thing to keep in mind is that Clang is divided into separate libraries; Sema is one of them, and so is the AST library, which is where types live. If the `ExtFunctionEffect` would end up being part of the `FunctionProtoType`, then it ought to be in the AST library. (I haven’t had the time to look at the changes yet; this is just me commenting on this comment here.)
https://github.com/llvm/llvm-project/pull/84983
More information about the cfe-commits
mailing list