From a8ba15f0d5a917caf3460a25e0a1155bdc9695b9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Aug 2016 21:23:51 -0400 Subject: [PATCH] intrusive_list: Make Remove and IsEmpty stdlib compatible Makes the name match the standard library equivalents. C++17 introduces non-member empty() which allows for nicer handling in generic contexts. May as well make the data structure compatible with it. --- src/common/intrusive_list.h | 4 ++-- src/frontend/translate/translate_arm.cpp | 2 +- src/ir_opt/dead_code_elimination_pass.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/intrusive_list.h b/src/common/intrusive_list.h index c4c90345..9308c255 100644 --- a/src/common/intrusive_list.h +++ b/src/common/intrusive_list.h @@ -91,7 +91,7 @@ public: * Removes node from list * @param node Node to remove from list. */ - void Remove(reference node) { + void remove(reference node) { node.UnlinkFromList(); } @@ -99,7 +99,7 @@ public: * Is this list empty? * @returns true if there are no nodes in this list. */ - bool IsEmpty() { + bool empty() const { return root->next == root.get(); } diff --git a/src/frontend/translate/translate_arm.cpp b/src/frontend/translate/translate_arm.cpp index 3000a4be..f97c4650 100644 --- a/src/frontend/translate/translate_arm.cpp +++ b/src/frontend/translate/translate_arm.cpp @@ -66,7 +66,7 @@ bool ArmTranslatorVisitor::ConditionPassed(Cond cond) { // non-AL cond - if (!ir.block.instructions.IsEmpty()) { + if (!ir.block.instructions.empty()) { // We've already emitted instructions. Quit for now, we'll make a new block here later. cond_state = ConditionalState::Break; ir.SetTerm(IR::Term::LinkBlockFast{ir.current_location}); diff --git a/src/ir_opt/dead_code_elimination_pass.cpp b/src/ir_opt/dead_code_elimination_pass.cpp index 419b5fe3..dec9eabd 100644 --- a/src/ir_opt/dead_code_elimination_pass.cpp +++ b/src/ir_opt/dead_code_elimination_pass.cpp @@ -61,7 +61,7 @@ void DeadCodeElimination(IR::Block& block) { // We iterate over the instructions in reverse order. // This is because removing an instruction reduces the number of uses for earlier instructions. - if (block.instructions.IsEmpty()) { + if (block.instructions.empty()) { return; }