Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/wayfire/config/compound-option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ class compound_option_entry_base_t
virtual ~compound_option_entry_base_t() = default;

/** @return The prefix of the tuple entry. */
std::string get_prefix() const
const std::string& get_prefix() const WF_LIFETIMEBOUND
{
return prefix;
}

/** @return The name of the tuple entry. */
std::string get_name() const
const std::string& get_name() const WF_LIFETIMEBOUND
{
return name;
}

/** @return The untyped default value of the tuple entry. */
std::optional<std::string> get_default_value() const
const std::optional<std::string>& get_default_value() const WF_LIFETIMEBOUND
{
return default_value;
}
Expand Down Expand Up @@ -224,12 +224,12 @@ class compound_option_t : public option_base_t
/**
* Get the type information about entries in the option.
*/
const entries_t& get_entries() const;
const entries_t& get_entries() const WF_LIFETIMEBOUND;

/**
* Check if this compound option has named tuples.
*/
std::string get_type_hint() const
const std::string& get_type_hint() const WF_LIFETIMEBOUND
{
return list_type_hint;
}
Expand Down
4 changes: 2 additions & 2 deletions include/wayfire/config/option-wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ class base_option_wrapper_t
}

/** Implicitly convertible to the value of the option */
operator Type() const
operator decltype(auto)() const WF_LIFETIMEBOUND
{
return this->value();
}

Type value() const
decltype(auto) value() const WF_LIFETIMEBOUND
{
if constexpr (is_std_vector<Type>::value)
{
Expand Down
12 changes: 9 additions & 3 deletions include/wayfire/config/option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

#include <memory>

#ifdef __clang__
#define WF_LIFETIMEBOUND [[clang::lifetimebound]]
#else
#define WF_LIFETIMEBOUND
#endif

namespace wf
{
namespace config
Expand All @@ -21,7 +27,7 @@ class option_base_t
option_base_t& operator =(const option_base_t& other) = delete;

/** @return The name of the option */
std::string get_name() const;
const std::string& get_name() const WF_LIFETIMEBOUND;

/** @return A copy of the option */
virtual std::shared_ptr<option_base_t> clone_option() const = 0;
Expand Down Expand Up @@ -253,12 +259,12 @@ class option_t : public option_base_t,
}
}

Type get_value() const
const Type& get_value() const WF_LIFETIMEBOUND
{
return value;
}

Type get_default_value() const
const Type& get_default_value() const WF_LIFETIMEBOUND
{
return default_value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "option-impl.hpp"
#include "wayfire/util/log.hpp"

std::string wf::config::option_base_t::get_name() const
const std::string& wf::config::option_base_t::get_name() const
{
return this->priv->name;
}
Expand Down