[clang] [RFC] Initial implementation of P2719 (PR #113510)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 13:39:24 PDT 2025
================
@@ -2527,6 +2527,32 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional<unsigned> *AlignmentParam = nullptr,
+ bool *IsNothrow = nullptr) const {
+ if (isTypeAwareOperatorNewOrDelete())
+ return false;
+ return isUsableAsGlobalAllocationFunctionInConstantEvaluation(
+ AlignmentParam, IsNothrow);
+ }
+
+ /// Determines whether this function is one of the replaceable global
+ /// allocation functions described in isReplaceableGlobalAllocationFunction,
+ /// or is a function that may be treated as such during constant evaluation.
+ /// This adds support for potentially templated type aware global allocation
+ /// functions of the form:
+ /// void *operator new(type-identity, std::size_t, std::align_val_t)
+ /// void *operator new(type-identity, std::size_t, std::align_val_t, const std::nothrow_t &) noexcept;
+ /// void *operator new[](type-identity, std::size_t, std::align_val_t)
+ /// void *operator new[](type-identity, std::size_t, std::align_val_t, const std::nothrow_t &) noexcept;
+ /// void operator delete(type-identity, void*, std::size_t, std::align_val_t) noexcept;
----------------
cor3ntin wrote:
looks fine? whatever `git clang-format <hash of the commit before the first of yours>` does
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list