From 3255896c8dfb4cffdb63476bb8c0997955d1b2f1 Mon Sep 17 00:00:00 2001 From: Vladimir Still Date: Fri, 5 Jan 2024 01:55:52 -0800 Subject: [PATCH] Allow constructing PassRepeated from a PassManager and add `explicit` to the constructors that could be accidentally invoced by implicit casts otherwise --- ir/pass_manager.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ir/pass_manager.h b/ir/pass_manager.h index 661b1c88196..4b117efd238 100644 --- a/ir/pass_manager.h +++ b/ir/pass_manager.h @@ -142,8 +142,10 @@ class PassRepeated : virtual public PassManager { unsigned repeats; // 0 = until convergence public: PassRepeated() : repeats(0) {} - PassRepeated(const std::initializer_list &init, unsigned repeats = 0) + explicit PassRepeated(const std::initializer_list &init, unsigned repeats = 0) : PassManager(init), repeats(repeats) {} + explicit PassRepeated(const PassManager &other, unsigned repeats = 0) + : PassManager(other), repeats(repeats) {} const IR::Node *apply_visitor(const IR::Node *, const char * = 0) override; PassRepeated *setRepeats(unsigned repeats) { this->repeats = repeats;