mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 22:06:06 +00:00
[scudo] Fix type mismatch on DefaultMaxEntrySize (#85897)
This commit is contained in:
parent
4095a326c0
commit
aa8cffb958
@ -110,7 +110,7 @@ SECONDARY_REQUIRED_TEMPLATE_TYPE(CacheT)
|
||||
SECONDARY_CACHE_OPTIONAL(const u32, EntriesArraySize, 0)
|
||||
SECONDARY_CACHE_OPTIONAL(const u32, QuarantineSize, 0)
|
||||
SECONDARY_CACHE_OPTIONAL(const u32, DefaultMaxEntriesCount, 0)
|
||||
SECONDARY_CACHE_OPTIONAL(const u32, DefaultMaxEntrySize, 0)
|
||||
SECONDARY_CACHE_OPTIONAL(const uptr, DefaultMaxEntrySize, 0)
|
||||
SECONDARY_CACHE_OPTIONAL(const s32, MinReleaseToOsIntervalMs, INT32_MIN)
|
||||
SECONDARY_CACHE_OPTIONAL(const s32, MaxReleaseToOsIntervalMs, INT32_MAX)
|
||||
|
||||
|
@ -27,6 +27,19 @@ template <typename T> struct voidAdaptor {
|
||||
using type = void;
|
||||
};
|
||||
|
||||
// This is used for detecting the case that defines the flag with wrong type and
|
||||
// it'll be viewed as undefined optional flag.
|
||||
template <typename L, typename R> struct assertSameType {
|
||||
template <typename, typename> struct isSame {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
template <typename T> struct isSame<T, T> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
static_assert(isSame<L, R>::value, "Flag type mismatches");
|
||||
using type = R;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace scudo {
|
||||
@ -36,7 +49,8 @@ namespace scudo {
|
||||
static constexpr removeConst<TYPE>::type getValue() { return DEFAULT; } \
|
||||
}; \
|
||||
template <typename Config> \
|
||||
struct NAME##State<Config, decltype(Config::MEMBER)> { \
|
||||
struct NAME##State< \
|
||||
Config, typename assertSameType<decltype(Config::MEMBER), TYPE>::type> { \
|
||||
static constexpr removeConst<TYPE>::type getValue() { \
|
||||
return Config::MEMBER; \
|
||||
} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user