================ @@ -4912,3 +4922,279 @@ void AutoType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::~FunctionEffect() = default; + +bool FunctionEffect::diagnoseConversion(bool Adding, QualType OldType, + FunctionEffectSet OldFX, + QualType NewType, + FunctionEffectSet NewFX) const { + return false; +} + +bool FunctionEffect::diagnoseRedeclaration(bool Adding, + const FunctionDecl &OldFunction, + FunctionEffectSet OldFX, + const FunctionDecl &NewFunction, + FunctionEffectSet NewFX) const { + return false; +} + +bool FunctionEffect::diagnoseMethodOverride(bool Adding, + const CXXMethodDecl &OldMethod, + FunctionEffectSet OldFX, + const CXXMethodDecl &NewMethod, + FunctionEffectSet NewFX) const { + return false; +} + +bool FunctionEffect::canInferOnDecl(const Decl *Caller, + FunctionEffectSet CallerFX) const { + return false; +} + +bool FunctionEffect::diagnoseFunctionCall(bool Direct, const Decl *Caller, + FunctionEffectSet CallerFX, + CalleeDeclOrType Callee, + FunctionEffectSet CalleeFX) const { + return false; +} + +const NoLockNoAllocEffect &NoLockNoAllocEffect::nolock_instance() { + static NoLockNoAllocEffect global(kNoLockTrue, "nolock"); + return global; +} + +const NoLockNoAllocEffect &NoLockNoAllocEffect::noalloc_instance() { + static NoLockNoAllocEffect global(kNoAllocTrue, "noalloc"); + return global; +} + +// TODO: Separate flags for noalloc +NoLockNoAllocEffect::NoLockNoAllocEffect(EffectType Ty, const char *Name) + : FunctionEffect(Ty, + kRequiresVerification | kVerifyCalls | + kInferrableOnCallees | kExcludeThrow | kExcludeCatch | + kExcludeObjCMessageSend | kExcludeStaticLocalVars | + kExcludeThreadLocalVars, + Name) {} + +NoLockNoAllocEffect::~NoLockNoAllocEffect() = default; + +std::string NoLockNoAllocEffect::attribute() const { + return std::string{"__attribute__((clang_"} + name().str() + "))"; +} ---------------- Sirraide wrote:
Ah, I see; looking at `printFunctionProtoAfter`, it really does just print `__attribute__` there; I would maybe consider either inlining it in that file or moving it there as a helper, because, while it makes sense to do something like this there, it just seems really weird out of context. https://github.com/llvm/llvm-project/pull/84983 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits