From b557403ab689e4d81d676f376b82548069509de9 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 15 May 2026 16:19:09 -0400 Subject: [PATCH] fix clang-tidy issues --- .../xrpl/ledger/helpers/AccountRootHelpers.h | 14 ++++---- include/xrpl/ledger/helpers/SLEBase.h | 34 +++++++++---------- .../ledger/helpers/AccountRootHelpers.cpp | 2 +- .../tx/transactors/nft/NFTokenBurn.cpp | 1 - 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/xrpl/ledger/helpers/AccountRootHelpers.h b/include/xrpl/ledger/helpers/AccountRootHelpers.h index 610e973b54..ff954696ca 100644 --- a/include/xrpl/ledger/helpers/AccountRootHelpers.h +++ b/include/xrpl/ledger/helpers/AccountRootHelpers.h @@ -27,7 +27,7 @@ namespace xrpl { template class AccountRoot : public SLEBase { - static constexpr bool kIS_WRITABLE = SLEBase::kIS_WRITABLE; + static constexpr bool kIsWritable = SLEBase::kIsWritable; AccountID const id_; @@ -37,7 +37,7 @@ public: AccountID const& id, ReadView const& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires(!kIS_WRITABLE) + requires(!kIsWritable) : SLEBase(view.read(keylet::account(id)), view, j), id_(id) { } @@ -47,7 +47,7 @@ public: AccountID const& id, ApplyView& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires kIS_WRITABLE + requires kIsWritable : SLEBase(keylet::account(id), view, j), id_(id) { } @@ -55,7 +55,7 @@ public: /** Converting constructor: writable → read-only. */ template AccountRoot(AccountRoot const& other) - requires(!kIS_WRITABLE) + requires(!kIsWritable) : SLEBase(other), id_(other.id()) { } @@ -67,7 +67,7 @@ public: AccountID const& id, ApplyView& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires kIS_WRITABLE + requires kIsWritable { return AccountRoot(id, view, j, std::make_shared(keylet::account(id))); } @@ -141,12 +141,12 @@ public: /** Adjust the owner count up or down. */ void adjustOwnerCount(std::int32_t amount) - requires kIS_WRITABLE; + requires kIsWritable; private: // Private constructor only used by `makeNew` AccountRoot(AccountID const& id, ApplyView& view, beast::Journal j, std::shared_ptr sle) - requires kIS_WRITABLE + requires kIsWritable : SLEBase(std::move(sle), view, j), id_(id) { this->insert(); diff --git a/include/xrpl/ledger/helpers/SLEBase.h b/include/xrpl/ledger/helpers/SLEBase.h index 98228976ce..ba12830b1d 100644 --- a/include/xrpl/ledger/helpers/SLEBase.h +++ b/include/xrpl/ledger/helpers/SLEBase.h @@ -32,13 +32,13 @@ template class SLEBase { public: - static constexpr bool kIS_WRITABLE = WritableView; + static constexpr bool kIsWritable = WritableView; // SLE pointer type: mutable for writable views, const for read-only - using sle_ptr_type = std::conditional_t, SLE::const_pointer>; + using sle_ptr_type = std::conditional_t, SLE::const_pointer>; // View reference type: ApplyView& for writable, ReadView const& for read-only - using view_ref_type = std::conditional_t; + using view_ref_type = std::conditional_t; virtual ~SLEBase() = default; @@ -100,7 +100,7 @@ public: /** Returns a mutable SLE for write operations */ [[nodiscard]] sle_ptr_type const& mutableSle() const - requires kIS_WRITABLE + requires kIsWritable { return sle_; } @@ -108,7 +108,7 @@ public: /** Returns true if this wrapper supports write operations */ [[nodiscard]] bool canModify() const - requires kIS_WRITABLE + requires kIsWritable { return sle_ != nullptr; } @@ -116,7 +116,7 @@ public: /** Returns the apply view for write operations */ [[nodiscard]] ApplyView& applyView() const - requires kIS_WRITABLE + requires kIsWritable { return view_; } @@ -124,7 +124,7 @@ public: /** Mutable dereference operators */ STLedgerEntry* operator->() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(canModify(), "xrpl::SLEBase::operator-> : can modify"); return sle_.get(); @@ -132,7 +132,7 @@ public: STLedgerEntry& operator*() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(canModify(), "xrpl::SLEBase::operator* : can modify"); return *sle_; @@ -140,7 +140,7 @@ public: void insert() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(canModify(), "xrpl::SLEBase::insert : can modify"); view_.insert(sle_); @@ -148,7 +148,7 @@ public: void erase() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(canModify(), "xrpl::SLEBase::erase : can modify"); view_.erase(sle_); @@ -156,7 +156,7 @@ public: void update() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(canModify(), "xrpl::SLEBase::update : can modify"); view_.update(sle_); @@ -164,7 +164,7 @@ public: void newSLE() - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(!canModify(), "xrpl::SLEBase::newSLE : no existing SLE"); sle_ = std::make_shared(key_); @@ -182,7 +182,7 @@ protected: SLE::const_pointer sle, ReadView const& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires(!kIS_WRITABLE) + requires(!kIsWritable) : view_(view), sle_(std::move(sle)), j_(j) { } @@ -194,7 +194,7 @@ protected: */ template SLEBase(SLEBase const& other) - requires(!kIS_WRITABLE) + requires(!kIsWritable) : view_(other.readView()), sle_(other.sle()), j_(other.journal()) { } @@ -204,7 +204,7 @@ protected: std::shared_ptr sle, ApplyView& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires kIS_WRITABLE + requires kIsWritable : view_(view) , key_(sle ? Keylet(sle->getType(), sle->key()) : Keylet(ltANY, uint256{})) , sle_(std::move(sle)) @@ -217,7 +217,7 @@ protected: Keylet const& key, ApplyView& view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) - requires kIS_WRITABLE + requires kIsWritable : view_(view), key_(key), sle_(view_.peek(key)), j_(j) { } @@ -230,7 +230,7 @@ protected: { }; [[no_unique_address]] - std::conditional_t key_{}; + std::conditional_t key_{}; sle_ptr_type sle_; beast::Journal j_; diff --git a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp index ee4b86dd7e..c3ebd944a1 100644 --- a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp @@ -125,7 +125,7 @@ AccountRoot::transferRate() const template void AccountRoot::adjustOwnerCount(std::int32_t amount) - requires kIS_WRITABLE + requires kIsWritable { XRPL_ASSERT(this->canModify(), "xrpl::adjustOwnerCount : can modify"); XRPL_ASSERT(amount, "xrpl::adjustOwnerCount : nonzero amount input"); diff --git a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp index 7a5dfa8145..2396bd7f97 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include