[core] Embrace c++20 (#352)
This commit is contained in:
parent
7086c682c2
commit
52d0e98e83
|
|
@ -49,6 +49,7 @@ namespace lspd {
|
|||
operator std::string_view() const {
|
||||
return c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr static char str_[]{chars..., '\0'};
|
||||
};
|
||||
|
|
@ -67,12 +68,14 @@ namespace lspd {
|
|||
|
||||
template<char... as>
|
||||
inline constexpr auto operator+(const std::string &a, const tstring<as...> &) {
|
||||
return a + std::string{as..., '\0'};
|
||||
char b[]{as..., '\0'};
|
||||
return a + b;
|
||||
}
|
||||
|
||||
template<char... as>
|
||||
inline constexpr auto operator+(const tstring<as...> &, const std::string &b) {
|
||||
return std::string{as..., '\0'} + b;
|
||||
char a[]{as..., '\0'};
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace lspd {
|
|||
|
||||
LSP_DEF_NATIVE_METHOD(void, ClassLinker, setEntryPointsToInterpreter, jobject method) {
|
||||
void *reflected_method = getArtMethodYahfa(env, method);
|
||||
if (deopted_methods.count(reflected_method)) {
|
||||
if (deopted_methods.contains(reflected_method)) {
|
||||
LOGD("method %p has been deopted before, skip...", reflected_method);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ namespace lspd {
|
|||
|
||||
bool IsClassPending(void *clazz) {
|
||||
std::shared_lock lk(pending_classes_lock_);
|
||||
return pending_classes_.count(clazz);
|
||||
return pending_classes_.contains(clazz);
|
||||
}
|
||||
|
||||
bool IsMethodPending(void *art_method) {
|
||||
bool result;
|
||||
{
|
||||
std::shared_lock lk(pending_methods_lock_);
|
||||
result = pending_methods_.count(art_method);
|
||||
result = pending_methods_.contains(art_method);
|
||||
}
|
||||
if (result) {
|
||||
std::unique_lock lk(pending_methods_lock_);
|
||||
|
|
@ -96,7 +96,7 @@ namespace lspd {
|
|||
|
||||
bool isHooked(void *art_method) {
|
||||
std::shared_lock lk(hooked_methods_lock_);
|
||||
return hooked_methods_.count(art_method);
|
||||
return hooked_methods_.contains(art_method);
|
||||
}
|
||||
|
||||
void recordHooked(void *art_method) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue